<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="description" content="PHP 知识点分享：


字符串的使用
可将字符串当作一个字符的集合来使用，可独立访问每个字符。仅适用于单字节字符（字母、数字、半角标点符号），像中文等不可用（utf8下，中文3字节表示）
$str = &quot;abcd&quot;;
..." />
    <meta name="keywords" content="PHP" />
    <link rel="stylesheet" href="https://hzqyihui.github.io/media/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://hzqyihui.github.io/styles/main.css">
    <!-- 代码渲染风格css -->
    
    <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/rainbow.min.css">
    
    <!-- 代码高亮插件 -->
    <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/highlight.min.js"></script>
    <!-- 代码复制插件 -->
    <script src="https://cdn.jsdelivr.net/gh/850552586/ericamcdn@0.1/js/clipboard.min.js"></script>
    <!-- live2d插件 -->
    <link rel="stylesheet" href="https://hzqyihui.github.io/media/css/live2d.css">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.13.1/css/all.min.css" rel="stylesheet">
    <!-- 数学公式 -->
    
    <title>PHP 知识点分享</title>

    <!-- 大纲索引css调整 -->
    
    <style>
        .markdownIt-TOC {
            margin-left: 28%;
            padding-left: 2px;
            width: 80%;
        }

        .markdownIt-TOC li {
            padding-left: 8%;
        }
    </style>
    
</head>

<body>
    <div id="landlord">
        <div class="message" style="opacity:0"></div>
        <canvas id="live2d" width="240" height="250" class="live2d"></canvas>
    </div>
    <div id="domainname" style="display:none">https://hzqyihui.github.io</div>
    <div id="content">
        <div>
            <!----------- 移动端导航栏👇 ----------------->
            <div id="bar">
                <style>
  .navmobile {
    z-index: 15;
    max-height: 40vh;
    overflow-y: scroll;
    overflow-x: hidden;
  }

  @media screen and (max-width: 1200px) {
    .navbar {
      max-width: 100vw;
    }
  }

  @media screen and (max-width:1200px) and (min-width: 768px) {
    @media (min-width: 768px) {
      .navbar-nav {
        float: right;
        margin: 0;
      }
    }
  }

  @media screen and (max-width:768px) {
    .mbapspan {
      padding: 0;
    }
  }
</style>
<div class="pjaxloading"  onclick="pjaxloadingClose()">
  <div class="loadingbackground"></div>
  <div id="loading">
    <div class="loading">
    </div>
  </div>
</div>
<nav class="navbar navbar-inverse navbar-fixed-top navmobile">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#barmenu"
        aria-expanded="false" id="barbutton">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a data-pjax class="navbar-brand" style="color:white" href="https://hzqyihui.github.io">MaxHua&#39;s Note&nbsp;&nbsp;|</a>
      <span class="navbar-brand mbapspan"><i id="mbaplayer" class="fa fa-play-circle-o" aria-hidden="true"
          style="font-size: 28px;top: 12px;position: absolute;" onclick="aplayerPlay();"></i></span>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="barmenu">
      <ul class="nav navbar-nav">
        
        
        <li>
          <a data-pjax href="/" style="color:white">
            首页
          </a>
        </li>
        
        
        
        <li>
          <a data-pjax href="/archives" style="color:white">
            归档
          </a>
        </li>
        
        
        
        <li>
          <a data-pjax href="/tags" style="color:white">
            标签
          </a>
        </li>
        
        
        
        <li>
          <a data-pjax href="/post/about" style="color:white">
            关于
          </a>
        </li>
        
        
        
        <li><a data-pjax href="https://hzqyihui.github.io/talk" style="color:white">说说</a></li>
        
        
          
        <li><a data-pjax href="https://hzqyihui.github.io/friends" style="color:white">友链</a></li>

        
        </ul>
      </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
  </nav>


  <!-- 引入jQuery核心js文件 -->
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
  <script>
    let btstate = false;
    var bt = $("#barbutton");
    var bm = $("#barmenu");
    bt.click(function () {
      dropdown();
    })
    function dropdown() {
      console.log(btstate);
      //下拉
      if (btstate == false) {
        bt.removeClass("collapsed");
        bt.attr("aria-expanded", "true");
        bm.attr("aria-expanded", "true")
        bm.fadeIn(700);
        btstate = true;
      }
      else {
        bt.addClass("collapsed");
        bt.attr("aria-expanded", "false");
        bm.removeClass("in");
        bm.hide();
        bm.attr("aria-expanded", "false");
        btstate = false;
      }
    }
  </script> 
            </div>
            <!----------- 移动端导航栏👆 ----------------->

            <!--------------- pc端菜单栏👇 ---------------->
            <div class="side"><head>
    <link rel="stylesheet" href="https://hzqyihui.github.io/media/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://hzqyihui.github.io/styles/main.css">
    
    <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/rainbow.min.css">
    
    <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/highlight.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/850552586/ericamcdn@0.1/js/clipboard.min.js"></script>
    <link rel="stylesheet" href="https://hzqyihui.github.io/media/css/live2d.css">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.13.1/css/all.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- fancybox -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
    <script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>


    <!--------- 数学公式👇---- -->
    
    <!--------- 数学公式👆----------------- -->
    <!--------- daovocie功能👇 ------------------->
    
    <script type="text/javascript">
        window.$crisp = [];
        window.CRISP_WEBSITE_ID = "6fbd6157-accf-49b0-9398-56a347b943f8";
        (function () {
            d = document;
            s = d.createElement("script");
            s.src = "https://client.crisp.chat/l.js";
            s.async = 1;
            d.getElementsByTagName("head")[0].appendChild(s);
        })();
    </script>
    
    <!--------- daovocie功能👆 ------------------->
    <!-- -----------------twikoo评论系统引入👇 --------->
    <script src="https://cdn.jsdelivr.net/npm/twikoo@1.3.1/dist/twikoo.all.min.js"></script>
    <!-- -----------------twikoo评论系统引入👆 --------->
    <!---------------- leancloud api 功能依赖引入👇 -------->
    <script src="https://cdn.jsdelivr.net/npm/leancloud-storage@3.13.0/dist/av-min.js"></script>
    <!---------------- leancloud api 功能依赖引入👆 -------->
    <!------------------ valine评论系统引入👇 ------------------>
    <script src="https://hzqyihui.github.io/media/js/valine.min.js"></script>
    <!------------------ valine评论系统引入👆 ------------------>
    <!---------------- 今日诗词api功能依赖👇 ----------------------->
    <script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
    <!---------------- 今日诗词api功能依赖👆 ----------------------->
    <!---------------- 今日诗词api功能依赖👇 ----------------------->
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ispeak-bber/ispeak-bber.min.js" charset="utf-8"></script>
    <!---------------- 哔哔功能依赖👆 ----------------------->


</head>

<style>
    body {
        overflow-x: hidden;
        height: 100vh;
        overflow-y: scroll;
        cursor: url("https://hzqyihui.github.io/media/images/mouse_cursor.png"), auto
    }
</style>

<body>
    <!--=------ 页面加载动态画面👇 --------------->
    <div class="pjaxloading" onclick="pjaxloadingClose()">
        <div class="loadingbackground"></div>
        <div id="loading-aname">
            <div class="loading-aname">
            </div>
        </div>
    </div>
    <!--=------ 页面加载动态画面👆 --------------->

    <!--------------- 左侧菜单栏👇 ------------------------>
    
    <div id=side>
        <div class="r_m_div">
            <a onclick="showAaplayer()"><i style="font-size: 20px;"><img
                        src='https://hzqyihui.github.io/media/images/music.png' alt="音乐播放器" class="musicbtn"></i></a>
        </div>
        <div class="avatar-border">
            <img src="https://hzqyihui.github.io/images/avatar.png?v=1665303694187" class="avatar">
        </div>
        <div class="sitename">MaxHua&#39;s Note</div>
        <span class="description" data-text='["当能力和欲望不匹配时，人会极度痛苦。"]'>&nbsp;</span>
        <div class="siteinfocontainer">
            <span class="siteinfo">文章</span>
            <span class="siteinfo">标签</span>
        </div>
        <div class="siteinfocontainer">
            <span class="siteinfo" id="siteinfo-postsnum"></span>
            <span class="siteinfo">60</span>
        </div>
        
        <div class="search">
            <!-- <input type="text" class="search-input" placeholder="标题搜索(●'◡'●)" /> -->
            <input type="text" class="search-input" placeholder="标题搜索 ⚆_⚆ つ♡">
            <div class="search-results"></div>
        </div>
        
    <div class="share-button">
        <span>Look At Me</span>
        
        <a href="https://github.com/hzqyihui" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="https://hzqyihui.github.io/media/images/github.png" alt=""></i></a>
        
        
        <a onclick="showqq()"><i style="font-size: 20px;"><img class="icon"
                    src="https://hzqyihui.github.io/media/images/QQ.png" alt=""></i></a>
        
        
        <a href="https://zhihu.com/people/hzq_yihui" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="https://hzqyihui.github.io/media/images/zh.png" alt=""></i></a>
        
        
        
        
        
        <a href="https://music.163.com/#/user/home?id=1318641230" target="_blank"><i style="font-size: 20px;"><img class="icon"
                    src="https://hzqyihui.github.io/media/images/wyy.png" alt=""></i></a>
        
        
    </div>
    <div id="qq" style="display:none">77430203</div>
    <!------------ 加载菜单按钮👇 ------------------------->
    <div class="menucontainer">
        
        
        <div class="mchocie description">
            <a data-pjax href="/" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="首页"></i>&nbsp;<span
                    data-text="首页">首页</span>
            </a>
        </div>
        
        
        
        <div class="mchocie description">
            <a data-pjax href="/archives" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="归档"></i>&nbsp;<span
                    data-text="归档">归档</span>
            </a>
        </div>
        
        
        
        <div class="mchocie description">
            <a data-pjax href="/tags" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="标签"></i>&nbsp;<span
                    data-text="标签">标签</span>
            </a>
        </div>
        
        
        
        <div class="mchocie description">
            <a data-pjax href="/post/about" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="关于"></i>&nbsp;<span
                    data-text="关于">关于</span>
            </a>
        </div>
        
        

        
        <div class="mchocie description">
            <a data-pjax href="https://hzqyihui.github.io/talk" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="说说"></i>&nbsp;<span data-text="说说">说说</span>
            </a>
        </div>
        
        
        
        <div class="mchocie description">
            <a data-pjax href="https://hzqyihui.github.io/friends" class="menubutton" style="margin-right: 15px;">
                <i><img class="icon menuicon" src="" alt="友人帐"></i>&nbsp;<span data-text="友人帐">友人帐</span>
            </a>
        </div>
        
        <!--  -->
    </div>
    <!------------ 加载菜单按钮👆 ------------------------->
    <hr>
    <style>
    .copyright {
        font-size: 15px;
        color: #d9d9d9;
    }


    @media screen and (min-width: 1200px) {
        .foot {
            width: 100%;
            height: 130px;
        }
    }

    @media screen and (max-width: 1200px) {
        .foot {
            display: none;
        }
    }
</style>

<body>
    <div class="foot">
        <div id="footinfo">Powered by <a href="https://github.com/hzqyihui/" target="_blank">Maxhua</a> | Theme: <a
                href="https://github.com/850552586/gridea-theme-fog">Fog</a>
            <div>
                
                <div id="sitegotimeDate">载入天数...</div>
                <div id="sitegotimes">载入时分秒...</div>
                <div id="cussitetime" style="display:none">02/22/2018</div>
                
            </div>
            <div>
                
            </div>
            <div class="copyright" style="color:white;text-align: center;">
            </div>
        </div>



    </div>
</body>

<script>
    //----------------------站点运行时间
    var now = new Date();

    function createtime() {
        var sitegotime = document.getElementById("cussitetime").innerHTML + " 00:00:00";
        var grt = new Date(sitegotime); //此处修改你的建站时间或者网站上线时间 
        now.setTime(now.getTime() + 250);
        days = (now - grt) / 1000 / 60 / 60 / 24;
        dnum = Math.floor(days);
        hours = (now - grt) / 1000 / 60 / 60 - (24 * dnum);
        hnum = Math.floor(hours);
        if (String(hnum).length == 1) {
            hnum = "0" + hnum;
        }
        minutes = (now - grt) / 1000 / 60 - (24 * 60 * dnum) - (60 * hnum);
        mnum = Math.floor(minutes);
        if (String(mnum).length == 1) {
            mnum = "0" + mnum;
        }
        seconds = (now - grt) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
        snum = Math.round(seconds);
        if (String(snum).length == 1) {
            snum = "0" + snum;
        }
        document.getElementById("sitegotimeDate").innerHTML = "本站已安全运行 " + dnum + " 天 ";
        document.getElementById("sitegotimes").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒";
    }

    let intervalId = setInterval("createtime()", 250);
</script>

    </div>

    <img class="moon" src="https://hzqyihui.github.io/media/images/moon.png" onclick="moonlight()">
    <script src="https://hzqyihui.github.io/media/js/wordshow.js"></script>
    
    <!--------------- 左侧菜单栏👆 ------------------------>

    <!----------------- 顶部菜单栏👇 ------------------------>
    
    <!----------------- 顶部菜单栏👆 ------------------------>

<!--核心功能加载-->
<script src="https://hzqyihui.github.io/media/js/mainfunc.js"></script>

<!------------- Fog1.0版本彩蛋👇 -------------->
    <!-- <section id="terrestrial" class="popup">
        <a href="#" class="back">&lt; back</a>
    </section>

    <div class="flycontainer">
        <div class="flyword">御风飞行中...</div>
    </div>

    <script>
        $("#fog_go").click(function(){fog_go()});
        async function fog_go(){
            $(".bars").hide()
            $("#live2d").hide()
            await sleep(3000);
            $(".flycontainer").css("display","flex");
            $(".popup").fadeOut(500)
            await sleep(2000);
            var sitename = "MaxHua&#39;s Note";
            getFogUser(sitename);
        }

        function fog_goregis(){
            var sitename = "MaxHua&#39;s Note";
            var siteurl = "https://hzqyihui.github.io";
            regisFogUser(sitename,siteurl);
        }
        fog_goregis();
    </script> -->
<!------------- Fog1.0版本彩蛋👆 -------------->
<script>
    function change_topmenu(){
        tmcolor = "black"
        tsnamecolor = "antiquewhite"
        $(".navbar-inverse .navbar-nav>li>a").css("color",tmcolor)
        $(".navbar-inverse .navbar-brand").css("color",tsnamecolor)
        $(".navbar-fixed-top").css("border-radius","0 0 10px 10px")
    }
</script>

<!------ 根据自定义配置声明变量👇 --------------------->
    
    <script>
        var postnumChoice = true
    </script>
    
    
    <script>
        var shareChoice = true
    </script>
    
    
    <script>
        var donateChoice = true
    </script>
    
    
    <script>
        var searchChoice = true
    </script>
    
    <script>let postsnum = 0;</script>
    <div id="side-posttitle" style="display: none;">
    
    
    Go语言Sync包的锁
    <script>
        postsnum += 1
    </script>
    
    
    
    
    
    Nacos安装和配置：
    <script>
        postsnum += 1
    </script>
    
    
    
    Nacos基本使用：
    <script>
        postsnum += 1
    </script>
    
    
    
    布隆过滤器
    <script>
        postsnum += 1
    </script>
    
    
    
    brew换源：
    <script>
        postsnum += 1
    </script>
    
    
    
    jenkins的安装和配置：
    <script>
        postsnum += 1
    </script>
    
    
    
    Kong怎么和Consul配套使用？
    <script>
        postsnum += 1
    </script>
    
    
    
    Kong的安装和配置：
    <script>
        postsnum += 1
    </script>
    
    
    
    什么是API网关？
    <script>
        postsnum += 1
    </script>
    
    
    
    RocketMQ Go 消息使用：
    <script>
        postsnum += 1
    </script>
    
    
    
    服务雪崩
    <script>
        postsnum += 1
    </script>
    
    
    
    gRPC的超时和重试
    <script>
        postsnum += 1
    </script>
    
    
    
    常见的幂等性解决方案
    <script>
        postsnum += 1
    </script>
    
    
    
    Rocket基本概念：
    <script>
        postsnum += 1
    </script>
    
    
    
    Rocket安装和配置
    <script>
        postsnum += 1
    </script>
    
    
    
    常见分布式事务解决方案：
    <script>
        postsnum += 1
    </script>
    
    
    
    CAP和BASE理论：
    <script>
        postsnum += 1
    </script>
    
    
    
    事务和分布式事务：
    <script>
        postsnum += 1
    </script>
    
    
    
    ElasticSearch学习：
    <script>
        postsnum += 1
    </script>
    
    
    
    什么是elasticsearch
    <script>
        postsnum += 1
    </script>
    
    
    
    Redis 的 RedLock：
    <script>
        postsnum += 1
    </script>
    
    
    
    常见的分布式锁的实现方案：
    <script>
        postsnum += 1
    </script>
    
    
    
    单机锁
    <script>
        postsnum += 1
    </script>
    
    
    
    Go工具-随机获取可用端口并监听：
    <script>
        postsnum += 1
    </script>
    
    
    
    负载均衡算法：
    <script>
        postsnum += 1
    </script>
    
    
    
    负载均衡策略：
    <script>
        postsnum += 1
    </script>
    
    
    
    JWT集成在Gin框架中
    <script>
        postsnum += 1
    </script>
    
    
    
    Go工具-Viper配置文件管理器
    <script>
        postsnum += 1
    </script>
    
    
    
    二叉树层序遍历
    <script>
        postsnum += 1
    </script>
    
    
    
    二叉树后序遍历
    <script>
        postsnum += 1
    </script>
    
    
    
    二叉树中序遍历
    <script>
        postsnum += 1
    </script>
    
    
    
    二叉树先序遍历
    <script>
        postsnum += 1
    </script>
    
    
    
    Dockerfile 的语法使用：
    <script>
        postsnum += 1
    </script>
    
    
    
    Nginx重写和转发规则：
    <script>
        postsnum += 1
    </script>
    
    
    
    HTTP版本：
    <script>
        postsnum += 1
    </script>
    
    
    
    HTTP请求响应过程：
    <script>
        postsnum += 1
    </script>
    
    
    
    TCP和UDP的区别：
    <script>
        postsnum += 1
    </script>
    
    
    
    插入排序
    <script>
        postsnum += 1
    </script>
    
    
    
    Go工具-proto文件编译
    <script>
        postsnum += 1
    </script>
    
    
    
    二分查找算法
    <script>
        postsnum += 1
    </script>
    
    
    
    sed命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    xargs命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    firewall命令（防火墙）：
    <script>
        postsnum += 1
    </script>
    
    
    
    nohup 命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    安装 FFmpeg：
    <script>
        postsnum += 1
    </script>
    
    
    
    umask命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    shell 笔记：
    <script>
        postsnum += 1
    </script>
    
    
    
    GIT分支与工作流
    <script>
        postsnum += 1
    </script>
    
    
    
    netstat命令：查看端口占用
    <script>
        postsnum += 1
    </script>
    
    
    
    nl命令：带行号查看文件
    <script>
        postsnum += 1
    </script>
    
    
    
    Git奇难杂症：
    <script>
        postsnum += 1
    </script>
    
    
    
    Redis安装笔记
    <script>
        postsnum += 1
    </script>
    
    
    
    排序的稳定性含义：
    <script>
        postsnum += 1
    </script>
    
    
    
    希尔排序
    <script>
        postsnum += 1
    </script>
    
    
    
    SSH开启无密码登录
    <script>
        postsnum += 1
    </script>
    
    
    
    改进版快速排序
    <script>
        postsnum += 1
    </script>
    
    
    
    冒泡排序
    <script>
        postsnum += 1
    </script>
    
    
    
    堆排序
    <script>
        postsnum += 1
    </script>
    
    
    
    选择排序
    <script>
        postsnum += 1
    </script>
    
    
    
    归并排序
    <script>
        postsnum += 1
    </script>
    
    
    
    位运算计算中间值：
    <script>
        postsnum += 1
    </script>
    
    
    
    递归的时间复杂度：
    <script>
        postsnum += 1
    </script>
    
    
    
    对数器
    <script>
        postsnum += 1
    </script>
    
    
    
    stat命令： 查看文件的修改
    <script>
        postsnum += 1
    </script>
    
    
    
    Windows快捷键
    <script>
        postsnum += 1
    </script>
    
    
    
    各类查找命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    Go进阶知识点
    <script>
        postsnum += 1
    </script>
    
    
    
    date命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    find 命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    Linux进程，内存查看
    <script>
        postsnum += 1
    </script>
    
    
    
    Go基础知识点
    <script>
        postsnum += 1
    </script>
    
    
    
    tree命令
    <script>
        postsnum += 1
    </script>
    
    
    
    GOROOT, GOPATH
    <script>
        postsnum += 1
    </script>
    
    
    
    locate 命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    Nginx 安装
    <script>
        postsnum += 1
    </script>
    
    
    
    PHP 知识点分享
    <script>
        postsnum += 1
    </script>
    
    
    
    Zsh 插件安装：
    <script>
        postsnum += 1
    </script>
    
    
    
    Linux系统基本知识点
    <script>
        postsnum += 1
    </script>
    
    
    
    Linux操作提升效率
    <script>
        postsnum += 1
    </script>
    
    
    
    Linux命令操作快捷键
    <script>
        postsnum += 1
    </script>
    
    
    
    YAML语法
    <script>
        postsnum += 1
    </script>
    
    
    
    VIM学习笔记：
    <script>
        postsnum += 1
    </script>
    
    
    
    经典快速排序
    <script>
        postsnum += 1
    </script>
    
    
    
    crontab
    <script>
        postsnum += 1
    </script>
    
    
    
    环境变量etc profile文件解析：
    <script>
        postsnum += 1
    </script>
    
    
    
    Linux etc sudoers文件说明：
    <script>
        postsnum += 1
    </script>
    
    
    
    Linux 用户，用户组相关命令
    <script>
        postsnum += 1
    </script>
    
    
    
    ln命令：对文件做链接，类似Windows的快捷方式
    <script>
        postsnum += 1
    </script>
    
    
    
    df
    <script>
        postsnum += 1
    </script>
    
    
    
    chmod：
    <script>
        postsnum += 1
    </script>
    
    
    
    用户埋点处理，用户行为分析技术：
    <script>
        postsnum += 1
    </script>
    
    
    
    PHP SPL扩展库
    <script>
        postsnum += 1
    </script>
    
    
    
    Beanstalked学习笔记：
    <script>
        postsnum += 1
    </script>
    
    
    
    tar命令：
    <script>
        postsnum += 1
    </script>
    
    
    
    GIT 原理   ：
    <script>
        postsnum += 1
    </script>
    
    
    
    tmux使用
    <script>
        postsnum += 1
    </script>
    
    
    
    Debian9学习笔记：
    <script>
        postsnum += 1
    </script>
    
    
    
    Docker学习笔记
    <script>
        postsnum += 1
    </script>
    
    
    
    在Debian9安装Docker
    <script>
        postsnum += 1
    </script>
    
    
    
    Git学习笔记
    <script>
        postsnum += 1
    </script>
    
    
    
    
    </div>
    
        <script>
            var menupos = 'left';
            $("#siteinfo-postsnum").html(postsnum);
        </script>
    
    <script>
        let commentsHide = false
    </script>
    <!------ 根据自定义配置声明变量👆 --------------------->


    <!----------根据自定义配置设置图标信息👇---------->
    <script>
        var icondict = new Array();
    </script>
    
        
            <script>
                var iconname = "首页";
                var iconurl = "Home";
                icondict[iconname] = iconurl;
            </script>
        
            <script>
                var iconname = "关于";
                var iconurl = "About";
                icondict[iconname] = iconurl;
            </script>
        
            <script>
                var iconname = "友人帐";
                var iconurl = "Friends";
                icondict[iconname] = iconurl;
            </script>
        
            <script>
                var iconname = "归档";
                var iconurl = "Archive";
                icondict[iconname] = iconurl;
            </script>
        
            <script>
                var iconname = "标签";
                var iconurl = "Tag";
                icondict[iconname] = iconurl;
            </script>
        
            <script>
                var iconname = "说说";
                var iconurl = "Talk";
                icondict[iconname] = iconurl;
            </script>
        
    
    <!----------根据自定义配置设置图标信息👆---------->
</body>

<script src="https://hzqyihui.github.io/media/share/dist/Share.js"></script>
<!-- 页面pjax测试 -->
<script src="https://cdn.bootcdn.net/ajax/libs/jquery.pjax/2.0.1/jquery.pjax.js"></script>
<!--确保jQuery已经在此之前加载-->
<!-- <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script> -->
<script src="https://hzqyihui.github.io/media/js/all-pjax.js"></script>
<script>
    //-------------------------------说说功能👇--------------------------------------
    let talksall = [];
    let talks = [];
    let talkindex = 0;
    get();

    function get() {
        var t = JSON.parse('[]');
        talkindex = t.length - 1;
        for (var i = 0; i <= t.length - 1; i++) {
            var d = {};
            d["time"] = t[i].time;
            d["author"] = t[i].author;
            d["text"] = t[i].text;
            d["img"] = t[i].img;
            talksall.push(d);
        }
    }

    function add() {
        for (var i = talkindex; i >= 0 && i > talkindex - 3; i--) {
            talks.push(talksall[i]);
        }
        talkindex = (talkindex - 3) >= 0 ? (talkindex - 3) : -1;
        if (talkindex < 0) $("#getmorebt").hide();
        show();
    }

    function show() {
        var talkT = document.getElementById("talkContainer");
        talkT.innerHTML = "";
        for (var i = 0; i < talks.length; i++) {
            if (talks[i].img != '') {
                talkT.innerHTML += '\
            <div class="talk" v-for="t in talks"> \
                <span data-fancybox="images" href="' + talks[i].img + '"><img src="' + talks[i].img + '" class="talkimg"></span> \
                <div class="ainfo">\
                    <div class="ainfo-intro">\
                        <div class="author">' + talks[i].author + '</div>·\
                        <div class="time">' + talks[i].time + '</div>\
                    </div>\
                </div>\
                <div class="talkcontent">' + talks[i].text + '\
                </div\>\
            ';
            } else {
                talkT.innerHTML += '\
            <div class="talk" v-for="t in talks"> \
                <div class="ainfo">\
                    <div class="ainfo-intro">\
                        <div class="author">' + talks[i].author + '</div>·\
                        <div class="time">' + talks[i].time + '</div>\
                    </div>\
                </div>\
                <div class="talkcontent">' + talks[i].text + '\
                </div\>\
            ';
            }
        }
    }
    //-------------------------------说说功能👆--------------------------------------
</script>

<!---->
<script>
    function replaceAvatar() {
        twikoo_avatar = $(".tk-avatar-img");
        for (var i = 0; i < twikoo_avatar.length; i++) {
            var asrc = twikoo_avatar.eq(i).attr('src');
            if (asrc.search('cn.gravatar.com') != -1) {
                twikoo_avatar.eq(i).attr('src', 'https://hzqyihui.github.io/media/images/comavatar.png');
            }
        }
    }

    function showWechat() {
        var wechat = '';
        alert("博主微信号：" + wechat);
        return false;
    }
</script>

<script>
    /**
     * https://github.com/tangkaichuan/gridea-search
     */
    // 检查缓存是否最新
    function checkCache() {
        var caches_postsnum = localStorage.getItem("postsnum");
        var pt = document.getElementById("side-posttitle").innerHTML;
        pt = pt.replace(/\s+/g, '').replace(/<script>.*?<\/script>/gi, "")
        var ptlen = pt.length;
        var ptlen_storage = localStorage.getItem("poststitlelen");
        if (caches_postsnum != postsnum || ptlen != ptlen_storage) {
            console.log("更新缓存");
            return false
        }
        return true;
    }

    (function () {
        var CACHES = checkCache()
        if (!CACHES) {
            var NOW = Date.now()
            var API_CONTENT = '../api-content/index.html' + '?_=' + NOW
            preload(API_CONTENT);
            getContents(show_getContentresult);
        }

        function show_getContentresult(data) {
            console.log("获取成功");
            var postslen = data["posts"].length;
            localStorage.setItem('postsnum', postslen);
            var poststitlelen = 0;
            var pt = document.getElementById("side-posttitle").innerHTML;
            pt = pt.replace(/\s+/g, '').replace(/<script>.*?<\/script>/gi, "");
            localStorage.setItem('poststitlelen', pt.length);
        }



        // preload
        function preload(url) {
            var preloadLink = document.createElement('link')
            preloadLink.href = url
            preloadLink.rel = 'preload'
            preloadLink.as = 'fetch'
            preloadLink.crossOrigin = 'anonymous'
            document.head.appendChild(preloadLink)
        }

        // 异步 GET 请求
        function get(obj) {
            var xhr = new XMLHttpRequest()
            xhr.open('get', obj.url, true)
            xhr.send(null)
            xhr.onreadystatechange = function () {
                // 异步请求：响应状态为4，数据加载完毕
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        obj.success(xhr.responseText)
                    } else {
                        obj.error(xhr.status)
                    }
                }
            }
        }

        // 获取博客全文 api
        function getContents(callback) {
            if (CACHES) {
                callback(CACHES.contents)
            } else {
                get({
                    url: API_CONTENT,
                    success: function (data) {
                        callback(JSON.parse(data));
                        localStorage.setItem('ContentsCache', data);
                        getStorageContent();
                    }
                })
            }
        }
    })()
    //------------------------核心功能--pjax全局渲染👇-------------------
    let talkinit = false;
    $(document).pjax('a[data-pjax]', '#main', {
        fragment: '#main',
        timeout: 8000
    }).on('pjax:complete', function () {
        //代码块高亮渲染
        document.querySelectorAll('pre code').forEach((block) => {
            hljs.highlightBlock(block);
        });
        //文章热度
        if(postnumChoice){
            getHotnum();
        }
        //文章索引
        toginit();
        //清空搜索栏
        if (searchChoice) {
            searchInit();
            searchInput.value = "";
        }
        var pl = window.location.pathname;
        //说说更新
        if (pl.search("talk") != -1 && !talkinit) {
            add();
            talkinit = true;
        } else if (pl.search("talk") != -1) {
            show();
        }
        if (pl.search("post") != -1) {
            if (shareChoice)
                shareInit();
            if (donateChoice)
                donateInit();
            if ("valine" == "default"&&!commentsHide) {
                $("#comment").hide()
                commentsHide = true
            }
            lazyload();
            codeinit();
            if ("valine" == "twikoo") {
                //twikoo头像更换
                setTimeout(replaceAvatar, 3000);
                setTimeout(replaceAvatar, 8000); //部分博主站点速度加载过慢，再添加一个延迟
            }
        }
        if (btstate == true)
            dropdown();
    }).on('pjax:start', function () {
        $(".pjaxloading").fadeIn(50);
    }).on('pjax:end', function () {
        $(".pjaxloading").fadeOut(50);
    });
    //------------------------核心功能--pjax全局渲染👆-------------------

    //-------------------------------------------------搜索
    // 获取搜索框、搜索按钮、清空搜索、结果输出对应的元素
    if (searchChoice) {
        var searchInput = document.querySelector('.search-input');
        var searchResults = document.querySelector('.search-results');
    }
    // 申明保存文章的标题、链接、内容的数组变量
    var searchValue = '',
        arrItems = [],
        arrLinks = [],
        arrTitles = [],
        arrContents = [],
        arrResults = [],
        indexItem = [],
        itemLength = 0;
    var tmpDiv = document.createElement('div');
    tmpDiv.className = 'result-item';


    function getStorageContent() {
        var data = localStorage.getItem('ContentsCache');
        data = JSON.parse(data);
        posts = data["posts"];
        for (var i = 0; i < posts.length; i++) {
            arrLinks[i] = posts[i].link;
            arrTitles[i] = posts[i].title;
            arrContents[i] = posts[i].content;
            itemLength++;
        }
    }
    if (checkCache())
        getStorageContent();
    // 输入框内容变化后就开始匹配，可以不用点按钮
    // 经测试，onkeydown, onchange 等方法效果不太理想，
    // 存在输入延迟等问题，最后发现触发 input 事件最理想，
    // 并且可以处理中文输入法拼写的变化
    searchInput.oninput = function () {
        setTimeout(searchConfirm, 0);
    }
    searchInput.onfocus = function () {
        searchResults.style.display = 'block';
    }

    function searchConfirm() {
        if (searchInput.value == '') {
            searchResults.style.display = 'none';
        } else if (searchInput.value.search(/^\s+$/) >= 0) {
            // 检测输入值全是空白的情况
            searchInit();
            var itemDiv = tmpDiv.cloneNode(true);
            itemDiv.innerText = '请输入有效内容...';
            searchResults.appendChild(itemDiv);
        } else {
            // 合法输入值的情况
            searchInit();
            searchValue = searchInput.value;
            // 在标题、内容中查找
            searchMatching(arrTitles, arrContents, searchValue);
        }
    }

    // 每次搜索完成后的初始化
    function searchInit() {
        arrResults = [];
        indexItem = [];
        searchResults.innerHTML = '';
        searchResults.style.display = 'block';
    }

    function searchMatching(arr1, arr2, input) {
        // 忽略输入大小写
        input = new RegExp(input, 'i');
        var step = 10;
        // 在所有文章标题、内容中匹配查询值
        for (i = 0; i < itemLength; i++) {
            var indexContent = arr2[i].search(input);
            //标题匹配
            if (arr1[i].search(input) != -1) {
                indexItem.push(i); // 保存匹配值的索引
                if (indexContent != -1) {
                    startindex = (indexContent - step) >= 0 ? (indexContent - step) : 0;
                    var searchcontent = arr2[i].slice(indexContent - step, indexContent + 5)
                    arrResults.push("....." + searchcontent + ".....");
                } else
                    arrResults.push("");
            }
            //内容匹配
            else if (indexContent != -1) {
                indexItem.push(i); // 保存匹配值的索引

                startindex = (indexContent - step) >= 0 ? (indexContent - step) : 0;
                var searchcontent = arr2[i].slice(indexContent - step, indexContent + 5)
                arrResults.push("....." + searchcontent + ".....");
            }
        }

        // 输出总共匹配到的数目
        var totalDiv = tmpDiv.cloneNode(true);
        totalDiv.innerHTML = '<b>总匹配：' + indexItem.length + ' 项<hr></b>';
        searchResults.appendChild(totalDiv);

        // 未匹配到内容的情况
        if (indexItem.length == 0) {
            var itemDiv = tmpDiv.cloneNode(true);
            itemDiv.innerText = '未匹配到内容...';
            searchResults.appendChild(itemDiv);
        }

        // 将所有匹配内容进行组合
        for (i = 0; i < arrResults.length; i++) {
            var itemDiv = tmpDiv.cloneNode(true);
            itemDiv.innerHTML = '<a data-pjax class="searchresults" href="' + arrLinks[indexItem[i]] + '"><b>[' +
                arrTitles[indexItem[i]] +
                ']</b><p>' + arrResults[i] + '</p></a><hr />';
            searchResults.appendChild(itemDiv);
        }
    }
</script>



<!--------------------- 菜单栏图标加载功能👇 ----------------------->
<script>
var menulist = $(".menuicon");
var menulength = menulist.length;
for (var i = 0; i < menulength; i++) {
    var altname = menulist.eq(i).attr("alt");
    var iconurl = icondict[altname];
    if (iconurl == undefined || iconurl == '')
        continue;
    if (iconurl == 'Home') {
        menulist.eq(i).attr("src", "https://hzqyihui.github.io/media/images/Home.png");
menulist.eq(i).show();
} else if (iconurl == 'Archive') {
menulist.eq(i).attr("src", "https://hzqyihui.github.io/media/images/Archive.png");
menulist.eq(i).show();
} else if (iconurl == 'Tag') {
menulist.eq(i).attr("src", "https://hzqyihui.github.io/media/images/Tag.png");
menulist.eq(i).show();
} else if (iconurl == 'About') {
menulist.eq(i).attr("src", "https://hzqyihui.github.io/media/images/About.png");
menulist.eq(i).show();
} else if (iconurl == 'Talk') {
menulist.eq(i).attr("src", "https://hzqyihui.github.io/media/images/Talk.png");
menulist.eq(i).show();
} else if (iconurl == 'Friends') {
menulist.eq(i).attr("src", "https://hzqyihui.github.io/media/images/Friends.png");
menulist.eq(i).show();
} else if (iconurl == 'Fly') {
menulist.eq(i).attr("src", "https://hzqyihui.github.io/media/images/wind.png");
menulist.eq(i).show();
} else {
menulist.eq(i).attr("src", iconurl);
menulist.eq(i).show();
}
}
</script>
<!--------------------- 菜单栏图标加载功能👆 ----------------------->

<script>
    //--------------------bber-onetalk加载👇--------------------------------
    function bberonetalkLoad(){
        bberjsonurl = '';
        if ( $("#bber-talk").length > 0 ) {
        jsonUrl = bberjsonurl
        $.getJSON(jsonUrl+"?t="+Date.parse( new Date()),function(res){
        var bberHtml = ''
        $.each(res.data, function(i, item){
            d = new Date(item.date)
            date = d.getFullYear()+'/'+(d.getMonth()+1)+'/'+d.getDate() +' '+d.getHours()+':'+d.getMinutes()+':'+d.getSeconds()
            dataTime = '<span class="datatime">'+date+'</span>'
            bberHtml += '<li class="item item-'+(i+1)+'">'+dataTime+'： <a data-pjax href="https://hzqyihui.github.io/bber">'+item.content+'</a></li>'
        });
        $('#bber-talk').append('<span class="index-talk-icon"><svg viewBox="0 0 1024 1024" width="21" height="21"><path d="M184.32 891.667692c-12.603077 0-25.206154-2.363077-37.809231-7.876923-37.021538-14.966154-59.864615-49.624615-59.864615-89.009231v-275.692307c0-212.676923 173.292308-385.969231 385.969231-385.969231h78.76923c212.676923 0 385.969231 173.292308 385.969231 385.969231 0 169.353846-137.846154 307.2-307.2 307.2H289.083077l-37.021539 37.021538c-18.904615 18.116923-43.323077 28.356923-67.741538 28.356923zM472.615385 195.347692c-178.018462 0-322.953846 144.935385-322.953847 322.953846v275.692308c0 21.267692 15.753846 29.144615 20.48 31.507692 4.726154 2.363077 22.055385 7.876923 37.021539-7.08923l46.473846-46.473846c6.301538-6.301538 14.178462-9.452308 22.055385-9.452308h354.461538c134.695385 0 244.184615-109.489231 244.184616-244.184616 0-178.018462-144.935385-322.953846-322.953847-322.953846H472.615385z"></path><path d="M321.378462 512m-59.076924 0a59.076923 59.076923 0 1 0 118.153847 0 59.076923 59.076923 0 1 0-118.153847 0Z"></path><path d="M518.301538 512m-59.076923 0a59.076923 59.076923 0 1 0 118.153847 0 59.076923 59.076923 0 1 0-118.153847 0Z"></path><path d="M715.224615 512m-59.076923 0a59.076923 59.076923 0 1 0 118.153846 0 59.076923 59.076923 0 1 0-118.153846 0Z"></path></svg></span><ul class="talk-list">'+bberHtml+'</ul>')
        //Lately({ 'target': '#bber-talk .datatime' });
        });
        function Roll (){
        var list_li = $('.talk-list li'),cur_li = list_li.first(),last_li = list_li.last();
        last_li.after(cur_li);
        };
        setInterval(Roll,3000);
    }
    }
  //--------------------bber-onetalk加载👆--------------------------------
</script>

<script>
    var ClicksideState = 1
    var cur_readingmode = false
    function readingmode(){
        if (!cur_readingmode){
            if(menupos == 'left'){
                if(ClicksideState==1)
                menu_openclose1()
            }
            $("#tab1").fadeOut(50)
            $("#bg").fadeOut(50)
            $(".navbar").fadeOut(50)
            $(".markdownIt-TOC li a").css("color","black")
            cur_readingmode = true
        }else{
            if(menupos == 'left'){
                if(ClicksideState==0)
                    menu_openclose1()
            }
            $("#tab1").fadeIn(50)
            $("#bg").fadeIn(50)
            $(".navbar").fadeIn(50)
            $(".markdownIt-TOC li a").css("color","antiquewhite")
            cur_readingmode = false  
        }
    }
</script>


<!----夜间模式👇-->
<script>
    var moonlightState = false
    function moonlight(){
        if(!moonlightState){
            $("#bg").fadeOut(200)
            $('body').css("background","rgba(0,0,0,0.8)")
            $(".markdownIt-TOC li a").css("color","white")
            $(".text p, .text ul").css("color","white")
            $("#articlecontent").css("color","white")
            $(".post-copyright").css("background","rgba(10,10,10,0.5)")
            $('blockquote').css("background","rgba(10,10,10,0.6)")
            $("#articlecontent").css("background","rgba(10,10,10,0.5)")
            moonlightState = true
            $(".moon").attr("src","https://hzqyihui.github.io/media/images/sun.png")
        }else{
            $("#bg").show()
            $(".markdownIt-TOC li a").css("color","antiquewhite")
            $(".text p, .text ul").css("color","rgba(0, 0, 0, 0.7)")
            $("#articlecontent").css("color","black")
            $(".post-copyright").css("background","#f9f9f9")
            $('blockquote').css("background","#eff8f0")
            $("#articlecontent").css("background","white")
            $(".moon").attr("src","https://hzqyihui.github.io/media/images/moon.png")
            $('body').css("background","white")
            moonlightState = false
        }
    }
</script>
<!----夜间模式👆--></div>
            <!--------------- pc端菜单栏👆 ---------------->

            <!-- ----------------左侧菜单栏html 👇-------------------------------------->
            
            <div>
                <div id="tab1" class="tab">
                    <div class="bars">
                        <span></span>
                        <span></span>
                        <span></span>
                    </div>
                    <div class="close"></div>
                </div>
                <div class="col-md-1 col-lg-3"></div>
                <!-- main标签，pjax渲染时加载以下内容👇 -->
                <div id="main" class="col-xs-12 col-sm-12 col-md-12 col-lg-7" style="padding:0;">
                    <div class="readingmode" onclick="readingmode()">阅</div>
                    <link rel="stylesheet" href="https://hzqyihui.github.io/media/css/font-awesome.css">

<body>
    <div class="allcontent" id="postdetail">
        <div class="postshow postpadding" style="padding-bottom: 0;">
            
            <div class="postdetailimg">
                <img src="https://oss.maxhua.cn/surface_cover/django-kai-fa-ge-ren-bo-ke-xi-tong.png" class="postimage" style="cursor:auto">
            </div>
            <div class="postinfo-detail">
                <div class="postdate"><i class="fa fa-calendar"></i>2019-09-24</div>
                <div class="poststatus postdate"><i class="fa fa-clock-o"></i> 19 min read</div>
                <div class="posttag">
                    
                    <a data-pjax href="https://hzqyihui.github.io/tag/SMP74JNiS/" class="postlink">
                        <i class="fa fa-tag"></i> PHP
                    </a>
                    
                </div>
            </div>
            
        <div id="articlecontent">
            <div id="texttitle" style="text-align: center">
                <h2 id="ptitle">PHP 知识点分享</h2>
                <!-- id 将作为查询条件 -->
                <div id="pl" style="display:none">https://hzqyihui.github.io/post/php-zhi-shi-dian-fen-xiang/</div>
                <div id="rootaddr" style="display:none">https://hzqyihui.github.io</div>
                
                    
                    <span id="hotnum">
                        <h4><i class="fa fa-eye" aria-hidden="true" style="color: #FF8C00;"></i>&nbsp;&nbsp;热度</i>: <i
                                class="hotnum">loading...</i></h4>
                    </span>
                    
                
            </div>
            <div class="text ">
                <p>PHP 知识点分享：</p>
<ol>
<li>
<p>字符串的使用<br>
可将字符串当作一个字符的集合来使用，可独立访问每个字符。仅适用于单字节字符（字母、数字、半角标点符号），像中文等不可用（utf8下，中文3字节表示）<br>
$str = &quot;abcd&quot;;<br>
echo $str[3];   // d<br>
echo <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>s</mi><mi>t</mi><mi>r</mi><mn>0</mn><mo separator="true">;</mo><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi>a</mi><mi mathvariant="normal">，</mi><mi>p</mi><mi>h</mi><mi>p</mi><mn>7.4</mn><mi mathvariant="normal">已</mi><mi mathvariant="normal">废</mi><mi mathvariant="normal">弃</mi><mrow></mrow><mi mathvariant="normal">这</mi><mi mathvariant="normal">种</mi><mi mathvariant="normal">方</mi><mi mathvariant="normal">式</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">另</mi><mi mathvariant="normal">一</mi><mi mathvariant="normal">种</mi><mi mathvariant="normal">方</mi><mi mathvariant="normal">式</mi><mi mathvariant="normal">也</mi><mi mathvariant="normal">可</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">使</mi><mi mathvariant="normal">用</mi><mi>s</mi><mi>t</mi><msub><mi>r</mi><mi>s</mi></msub><mi>p</mi><mi>l</mi><mi>i</mi><mi>t</mi><mi mathvariant="normal">把</mi><mi mathvariant="normal">所</mi><mi mathvariant="normal">有</mi><mi mathvariant="normal">字</mi><mi mathvariant="normal">符</mi><mi mathvariant="normal">分</mi><mi mathvariant="normal">割</mi><mi mathvariant="normal">成</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">组</mi><mi mathvariant="normal">。</mi></mrow><annotation encoding="application/x-tex">str{0};   // a， php7.4 已废弃 {} 这种方式
//另一种方式
也可以使用str_split把所有字符分割成数组。
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord"><span class="mord">0</span></span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">/</span><span class="mord">/</span><span class="mord mathdefault">a</span><span class="mord cjk_fallback">，</span><span class="mord mathdefault">p</span><span class="mord mathdefault">h</span><span class="mord mathdefault">p</span><span class="mord">7</span><span class="mord">.</span><span class="mord">4</span><span class="mord cjk_fallback">已</span><span class="mord cjk_fallback">废</span><span class="mord cjk_fallback">弃</span><span class="mord"></span><span class="mord cjk_fallback">这</span><span class="mord cjk_fallback">种</span><span class="mord cjk_fallback">方</span><span class="mord cjk_fallback">式</span><span class="mord">/</span><span class="mord">/</span><span class="mord cjk_fallback">另</span><span class="mord cjk_fallback">一</span><span class="mord cjk_fallback">种</span><span class="mord cjk_fallback">方</span><span class="mord cjk_fallback">式</span><span class="mord cjk_fallback">也</span><span class="mord cjk_fallback">可</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">使</span><span class="mord cjk_fallback">用</span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.02778em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">s</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">p</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">i</span><span class="mord mathdefault">t</span><span class="mord cjk_fallback">把</span><span class="mord cjk_fallback">所</span><span class="mord cjk_fallback">有</span><span class="mord cjk_fallback">字</span><span class="mord cjk_fallback">符</span><span class="mord cjk_fallback">分</span><span class="mord cjk_fallback">割</span><span class="mord cjk_fallback">成</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">组</span><span class="mord cjk_fallback">。</span></span></span></span>strArr = str_spilt(<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>s</mi><mi>t</mi><mi>r</mi><mo>)</mo><mo separator="true">;</mo><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">同</mi><mi mathvariant="normal">样</mi><mi mathvariant="normal">不</mi><mi mathvariant="normal">适</mi><mi mathvariant="normal">合</mi><mi mathvariant="normal">中</mi><mi mathvariant="normal">文</mi><mi>A</mi><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mo>(</mo><mo>[</mo><mn>0</mn><mo>]</mo><mo>=</mo><mo>&gt;</mo><mi>a</mi><mo>[</mo><mn>1</mn><mo>]</mo><mo>=</mo><mo>&gt;</mo><mi>b</mi><mo>[</mo><mn>2</mn><mo>]</mo><mo>=</mo><mo>&gt;</mo><mi>c</mi><mo>[</mo><mn>3</mn><mo>]</mo><mo>=</mo><mo>&gt;</mo><mi>d</mi><mo>)</mo><mi>f</mi><mi>u</mi><mi>n</mi><mi>c</mi><mi>t</mi><mi>i</mi><mi>o</mi><mi>n</mi><mi>m</mi><msub><mi>b</mi><mi>s</mi></msub><mi>t</mi><msub><mi>r</mi><mi>s</mi></msub><mi>p</mi><mi>l</mi><mi>i</mi><mi>t</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">str);   //同样不适合中文
Array
(
[0] =&gt; a
[1] =&gt; b
[2] =&gt; c
[3] =&gt; d
)
function mb_str_split(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">/</span><span class="mord">/</span><span class="mord cjk_fallback">同</span><span class="mord cjk_fallback">样</span><span class="mord cjk_fallback">不</span><span class="mord cjk_fallback">适</span><span class="mord cjk_fallback">合</span><span class="mord cjk_fallback">中</span><span class="mord cjk_fallback">文</span><span class="mord mathdefault">A</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="mopen">(</span><span class="mopen">[</span><span class="mord">0</span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">a</span><span class="mopen">[</span><span class="mord">1</span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">b</span><span class="mopen">[</span><span class="mord">2</span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">c</span><span class="mopen">[</span><span class="mord">3</span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">d</span><span class="mclose">)</span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord mathdefault">c</span><span class="mord mathdefault">t</span><span class="mord mathdefault">i</span><span class="mord mathdefault">o</span><span class="mord mathdefault">n</span><span class="mord mathdefault">m</span><span class="mord"><span class="mord mathdefault">b</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">s</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">t</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.02778em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">s</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">p</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">i</span><span class="mord mathdefault">t</span><span class="mopen">(</span></span></span></span>str){<br>
return preg_split('/(?&lt;!^)(?!$)/u', <span class='katex-error' title='ParseError: KaTeX parse error: Expected &#039;EOF&#039;, got &#039;}&#039; at position 25: …//反向预搜索， 正向预搜索
}̲
'>str );   //反向预搜索， 正向预搜索
}
</span>str='博客';<br>
mb_str_split($str);<br>
打印结果如下：<br>
Array<br>
(<br>
[0] =&gt; 博<br>
[1] =&gt; 客<br>
)</p>
</li>
<li>
<p>转换类型<br>
平时 我们知道在变量前，加上(int), (string), (float) 之类的即可进行显示转换，下面介绍一种，可直接转换为null的 转换，。<br>
(unset) //转换为NULL<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>a</mi><msup><mo>=</mo><mo mathvariant="normal">′</mo></msup><msup><mi>a</mi><mo mathvariant="normal">′</mo></msup><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">a = &#x27;a&#x27;;
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.751892em;vertical-align:0em;"></span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel"><span class="mrel">=</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.946332em;vertical-align:-0.19444em;"></span><span class="mord"><span class="mord mathdefault">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct">;</span></span></span></span>a = (unset)<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>a</mi><mo separator="true">;</mo><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">此</mi><mi mathvariant="normal">时</mi></mrow><annotation encoding="application/x-tex">a;  //此时</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">a</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">/</span><span class="mord">/</span><span class="mord cjk_fallback">此</span><span class="mord cjk_fallback">时</span></span></span></span>a 为 NULL<br>
//换种方式<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>a</mi><msup><mo>=</mo><mo mathvariant="normal">′</mo></msup><msup><mi>a</mi><mo mathvariant="normal">′</mo></msup><mo separator="true">;</mo><mi>u</mi><mi>n</mi><mi>s</mi><mi>e</mi><mi>t</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">a = &#x27;a&#x27;;
unset(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.751892em;vertical-align:0em;"></span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel"><span class="mrel">=</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1.001892em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathdefault">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord mathdefault">s</span><span class="mord mathdefault">e</span><span class="mord mathdefault">t</span><span class="mopen">(</span></span></span></span>a);<br>
dd($a);<br>
//报错<br>
PHP Notice:  Undefined variable: a in test.php on line 39</p>
</li>
</ol>
<p>Notice: Undefined variable: a in test.php on line 39</p>
<ol start="3">
<li>
<p>isset 和 empty, is_null 对变量的检测<br>
3.1 isset 要检测变量不存在则， 返回 false； 但需要注意，变量是否本身为 Null值， 如果是，也返回 false； 都不满足则返回true了 。<br>
为了更方便检测变量是否存在，可使用<br>
建议用array_key_exists判断<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>a</mi><mo>=</mo><mi>n</mi><mi>u</mi><mi>l</mi><mi>l</mi><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">a = null;
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord mathdefault">n</span><span class="mord mathdefault">u</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mpunct">;</span></span></span></span>varExists = array_key_exists('a', get_defined_vars());<br>
if($varExists){<br>
echo '变量a是存在的';<br>
}<br>
3.2 empty， 检测变量不存在，与各个空值，0值都为true， 否则为 false<br>
3.3 is_null<br>
当参数满足下面三种情况时，is_null()将返回TRUE，其它的情况就是FALSE<br>
1、它被赋值为NULL<br>
2、它还没有赋值<br>
3、它未定义，相当于unset(),将一个变量unset()后，不就是没有定义吗</p>
</li>
<li>
<p>static 的部分用法<br>
我们都知道 static 可以直接定义静态变量和 静态方法， 无论是调用静态变量和静态方法， 用 :: 即可调用， 如果是本类，则使用self 调用， 如果是在类<br>
外部，则使用类名进行调用， 但这里对其不进行过多赘述，这些都是比较常用。下面讲下不常用的。</p>
</li>
</ol>
<p>static在类中的延迟静态绑定；<br>
延迟静态绑定是指允许在一个静态继承的上下文中引用被调用类。<br>
延迟绑定的意思为：static::不再为定义当前方法所在的类，而是实际运行时所在的类。<br>
(总的意思就是子类继承了父类后，父类中使用了一个静态方法或变量，如static::A()， 但方法A不存在于父类中，<br>
存在于子类中，这样写是正确的，不会因为方法不存在而报错，因为static 修饰的A 会在执行过程中，绑定到具体的子类<br>
上，只要保证子类有此方法即可)<br>
注：它可以用于(但不限于)静态方法的调用。<br>
self::，代表本类(当前代码所在类)<br>
永远代表本类，因为在类编译时已经被确定。<br>
即，子类调用父类方法，self却不代表调用的子类。<br>
parent:: 代表父类<br>
static::，代表本类(调用该方法的类)<br>
用于在继承范围内引用静态调用的类。<br>
运行时，才确定代表的类。<br>
static::不再被解析为定义当前方法所在的类，而是在实际运行时计算的。<br>
除了简单的static延迟绑定的用法，还有一种转发调用，<br>
forward_static_call_array()(该函数只能在方法中调用)将转发调用信息（不过多赘述，类似于本节的第8点，PHP反射），<br>
概括实例如下：<br>
class A {<br>
public static function fooStatic() {<br>
static::who();<br>
}<br>
public static function who() {<br>
echo <strong>CLASS</strong>.&quot;aaa\n&quot;;<br>
}<br>
}<br>
class B extends A {<br>
public static function testStatic() {<br>
A::fooStatic();<br>
B::fooStatic();<br>
C::fooStatic();<br>
parent::fooStatic();<br>
self::fooStatic();<br>
}<br>
public static function who() {<br>
echo <strong>CLASS</strong>.&quot;bbb\n&quot;;<br>
}<br>
}<br>
class C extends B {<br>
public static function who() {<br>
echo <strong>CLASS</strong>.&quot;ccc\n&quot;;<br>
}<br>
}<br>
C::testStatic();<br>
大家一起来得到答案：</p>
<ol start="5">
<li>array_merge 和 + ， 合并数组<br>
5.1 array_merge 合并两个或多个数组的时候， 如果键名是非数字，则会自动合并到一起，但若出现重复的键名，后面的会覆盖前面的。<br>
若键名为数字，其会根据前一个数组的索引值，自动给后面的更改索引值为前面的递增，也就是说会改变原有的键名。<br>
5.2 + 合并数组， 使用+ 号 合并数组，键名相同的情况下，最先出现的键名会被保留， 并且即使键名是数字，也不会被重新编排，这个特性<br>
对部分业务场景会非常有用。<br>
5.3 array_push, 仅仅是把对应值完全放到数组末尾， 原来的结构会被保留，整个作为一个新的值， 键名跟着前一个递增。这与array_merge 有所区别<br>
5.4 array_combine， 两个参数， 第一个参数，作为新数组的键， 第二个参数作为新数组的值。 并不是给原有数组增添新值。所以其实他不同于 上面三个的作用。 光从名字上看容易混淆。<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>a</mi><mo>=</mo><msup><mo>[</mo><mo mathvariant="normal">′</mo></msup><msup><mi>a</mi><mo mathvariant="normal">′</mo></msup><msup><mo separator="true">,</mo><mo mathvariant="normal">′</mo></msup><msup><mi>b</mi><mo mathvariant="normal">′</mo></msup><msup><mo separator="true">,</mo><mo mathvariant="normal">′</mo></msup><msup><mi>c</mi><mo mathvariant="normal">′</mo></msup><mo>]</mo><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">a = [&#x27;a&#x27;, &#x27;b&#x27;, &#x27;c&#x27;];
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathdefault">a</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1.001892em;vertical-align:-0.25em;"></span><span class="mopen"><span class="mopen">[</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mord"><span class="mord mathdefault">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct"><span class="mpunct">,</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathdefault">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct"><span class="mpunct">,</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathdefault">c</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mclose">]</span><span class="mpunct">;</span></span></span></span>b = ['5' =&gt; 'test'];<br>
$c = [1, 2, 3];</li>
</ol>
<p><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>a</mi><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mi>M</mi><mi>e</mi><mi>r</mi><mi>g</mi><mi>e</mi><mo>=</mo><mi>a</mi><mi>r</mi><mi>r</mi><mi>a</mi><msub><mi>y</mi><mi>m</mi></msub><mi>e</mi><mi>r</mi><mi>g</mi><mi>e</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">arrayMerge   = array_merge(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8777699999999999em;vertical-align:-0.19444em;"></span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="mord mathdefault" style="margin-right:0.10903em;">M</span><span class="mord mathdefault">e</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="mord mathdefault">e</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.03588em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">m</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">e</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="mord mathdefault">e</span><span class="mopen">(</span></span></span></span>a, <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>b</mi><mo>)</mo><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">b);
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">b</span><span class="mclose">)</span><span class="mpunct">;</span></span></span></span>arrayPlus    = $a + <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>b</mi><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">b;
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord mathdefault">b</span><span class="mpunct">;</span></span></span></span>arrayCombine = array_combine($a, <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>c</mi><mo>)</mo><mo separator="true">;</mo><mi>a</mi><mi>r</mi><mi>r</mi><mi>a</mi><msub><mi>y</mi><mi>p</mi></msub><mi>u</mi><mi>s</mi><mi>h</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">c);
array_push(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.036108em;vertical-align:-0.286108em;"></span><span class="mord mathdefault">c</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.15139200000000003em;"><span style="top:-2.5500000000000003em;margin-left:-0.03588em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mord mathdefault">u</span><span class="mord mathdefault">s</span><span class="mord mathdefault">h</span><span class="mopen">(</span></span></span></span>a, $b);<br>
// $arrayMerge<br>
Array<br>
(<br>
[0] =&gt; a<br>
[1] =&gt; b<br>
[2] =&gt; c<br>
[3] =&gt; test<br>
)<br>
// $arrayPlus<br>
Array<br>
(<br>
[0] =&gt; a<br>
[1] =&gt; b<br>
[2] =&gt; c<br>
[5] =&gt; test<br>
)<br>
// $arrayCombine<br>
Array<br>
(<br>
[a] =&gt; 1<br>
[b] =&gt; 2<br>
[c] =&gt; 3<br>
)<br>
// array_push<br>
Array<br>
(<br>
[0] =&gt; a<br>
[1] =&gt; b<br>
[2] =&gt; c<br>
[3] =&gt; Array<br>
(<br>
[5] =&gt; test<br>
)</p>
<p>)</p>
<ol start="6">
<li>指针<br>
数组的内部指针：<br>
current/pos 返回当前被内部指针指向的数组单元的值，并不移动指针。<br>
key         返回数组中当前单元的键名，并不移动指针<br>
next        将数组中的内部指针向前移动一位，并返回移动后当前单元的值。先移动，再取值。<br>
prev        将数组的内部指针倒回一位，并返回移动后当前单元的值先移动，再取值。<br>
end         将数组的内部指针指向最后一个单元，并返回最后一个单元的值<br>
reset       将数组的内部指针指向第一个单元，并返回第一个数组单元的值<br>
each        返回数组中当前的键/值对并将数组指针向前移动一步。<br>
返回的是一个由键和值组成的长度为4的数组，下标0和key表示键，下标1和value表示值<br>
在执行each()之后，数组指针将停留在数组中的下一个单元或者当碰到数组结尾时停留在最后一个单元。如果要再用 each 遍历数组，必须使用 reset()。</li>
<li>以上指针操作函数，除了key()，若指针移出数组，则返回false。而key()移出则返回null。</li>
<li>若指针非法，不能进行next/prev操作，能进行reset/end操作</li>
<li>current/next/prev     若遇到包含空单元（0或&quot;&quot;）也会返回false。而each不会！</li>
</ol>
<p>list    把数组中的值赋给一些变量。list()是语言结构，不是函数。<br>
仅能用于数字索引的数组并假定数字索引从0开始<br>
/* 可用于交换多个变量的值 */<br>
list($a, <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>b</mi><mo>)</mo><mo>=</mo><mi>a</mi><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">b) = array(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">b</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="mopen">(</span></span></span></span>b, <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>a</mi><mo>)</mo><mo separator="true">;</mo><mi mathvariant="normal">例</mi><mi mathvariant="normal">：</mi><mi>l</mi><mi>i</mi><mi>s</mi><mi>t</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">a);
例：list(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">a</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord cjk_fallback">例</span><span class="mord cjk_fallback">：</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">i</span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mopen">(</span></span></span></span>drink, , $power) = array('coffee', 'brown', 'caffeine');</p>
<ol>
<li>
<p>复制数组，其指针位置也会被复制。<br>
特例：如果数组指针非法，则拷贝的数组指针会重置，而原数组的指针不变。<br>
【指针问题】<br>
谁第一个进行写操作，就会开辟一个新的值空间。与变量(数组变量)值传递给谁无关。<br>
数组函数current()被定义为写操作，故会出现问题。<br>
foreach遍历的是数组的拷贝，当被写时，才会开辟一个新的值空间。<br>
即，foreach循环体对原数组进行写操作时，才会出现指针问题。<br>
如果开辟新空间时指针非法，则会初始化指针。</p>
</li>
<li>
<p>如果指针位置出现问题，则reset()初始化一下就可解决。</p>
</li>
<li>
<p>序列化（串行化）</p>
</li>
</ol>
<h1 id="数据传输均是字符串类型">数据传输均是字符串类型</h1>
<h1 id="除了资源类型均可序列化">除了资源类型，均可序列化</h1>
<h1 id="序列化在存放数据时会存放数据本身也会存放数据类型">序列化在存放数据时，会存放数据本身，也会存放数据类型</h1>
<p>作用：1.在网络传输数据时；2.为了将数组或对象放在磁盘时</p>
<h1 id="序列化">序列化</h1>
<p>serialize        产生一个可存储的值的表示<br>
string serialize ( mixed $value )</p>
<ul>
<li>返回字符串，此字符串包含了表示value的字节流，可以存储于任何地方。</li>
<li>有利于存储或传递 PHP 的值，同时不丢失其类型和结构。</li>
</ul>
<h1 id="反序列化">反序列化</h1>
<p>unserialize        从已存储的表示中创建PHP的值<br>
mixed unserialize ( string $str [, string $callback ] )</p>
<ul>
<li>对单一的已序列化的变量进行操作，将其转换回PHP的值。</li>
</ul>
<p>8 . PHP反射<br>
有时候我们我们为了能建立更好的代码结构，并能复用代码，就需要用到一些语言的特性来帮助我们完成任务，比如我们这次新建的仓库 trinity_middle_service， 我们需要利用PHP自带函数， 如call_user_func_array， 即可简单实现分发。使用方式如下：<br>
class Order{<br>
public function getBasicInfo($orderId, <span class='katex-error' title='ParseError: KaTeX parse error: Expected &#039;EOF&#039;, got &#039;}&#039; at position 28: …e)
    {
    }
}̲
'>write = false)
    {
    }
}
</span>detailServiceInstance = new Order();<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>f</mi><mi>u</mi><mi>n</mi><mi>c</mi><mi>t</mi><mi>i</mi><mi>o</mi><mi>n</mi><mi>N</mi><mi>a</mi><mi>m</mi><mi>e</mi><msup><mo>=</mo><mo mathvariant="normal">′</mo></msup><mi>g</mi><mi>e</mi><mi>t</mi><mi>B</mi><mi>a</mi><mi>s</mi><mi>i</mi><mi>c</mi><mi>I</mi><mi>n</mi><mi>f</mi><msup><mi>o</mi><mo mathvariant="normal">′</mo></msup><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">functionName = &#x27;getBasicInfo&#x27;;
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.946332em;vertical-align:-0.19444em;"></span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord mathdefault">c</span><span class="mord mathdefault">t</span><span class="mord mathdefault">i</span><span class="mord mathdefault">o</span><span class="mord mathdefault">n</span><span class="mord mathdefault" style="margin-right:0.10903em;">N</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">e</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel"><span class="mrel">=</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.946332em;vertical-align:-0.19444em;"></span><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="mord mathdefault">e</span><span class="mord mathdefault">t</span><span class="mord mathdefault" style="margin-right:0.05017em;">B</span><span class="mord mathdefault">a</span><span class="mord mathdefault">s</span><span class="mord mathdefault">i</span><span class="mord mathdefault">c</span><span class="mord mathdefault" style="margin-right:0.07847em;">I</span><span class="mord mathdefault">n</span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord"><span class="mord mathdefault">o</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct">;</span></span></span></span>params[0] = 1000001;    //或 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>p</mi><mi>a</mi><mi>r</mi><mi>a</mi><mi>m</mi><mi>s</mi><msup><mo>[</mo><mo mathvariant="normal">′</mo></msup><mi>o</mi><mi>r</mi><mi>d</mi><mi>e</mi><mi>r</mi><mi>I</mi><msup><mi>d</mi><mo mathvariant="normal">′</mo></msup><mo>]</mo><mo>=</mo><mn>1000001</mn></mrow><annotation encoding="application/x-tex">params[&#x27;orderId&#x27;] = 1000001
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.001892em;vertical-align:-0.25em;"></span><span class="mord mathdefault">p</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">s</span><span class="mopen"><span class="mopen">[</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">d</span><span class="mord mathdefault">e</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.07847em;">I</span><span class="mord"><span class="mord mathdefault">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span><span class="mord">0</span><span class="mord">0</span><span class="mord">0</span><span class="mord">0</span><span class="mord">1</span></span></span></span>params[1] = true;       //或 <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>p</mi><mi>a</mi><mi>r</mi><mi>a</mi><mi>m</mi><mi>s</mi><msup><mo>[</mo><mo mathvariant="normal">′</mo></msup><mi>w</mi><mi>r</mi><mi>i</mi><mi>t</mi><msup><mi>e</mi><mo mathvariant="normal">′</mo></msup><mo>]</mo><mo>=</mo><mi>t</mi><mi>r</mi><mi>u</mi><mi>e</mi><mi>c</mi><mi>a</mi><mi>l</mi><msub><mi>l</mi><mi>u</mi></msub><mi>s</mi><mi>e</mi><msub><mi>r</mi><mi>f</mi></msub><mi>u</mi><mi>n</mi><msub><mi>c</mi><mi>a</mi></msub><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mo>(</mo><mo>[</mo></mrow><annotation encoding="application/x-tex">params[&#x27;write&#x27;] = true
call_user_func_array([</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.001892em;vertical-align:-0.25em;"></span><span class="mord mathdefault">p</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">s</span><span class="mopen"><span class="mopen">[</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mord mathdefault" style="margin-right:0.02691em;">w</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">i</span><span class="mord mathdefault">t</span><span class="mord"><span class="mord mathdefault">e</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1.036108em;vertical-align:-0.286108em;"></span><span class="mord mathdefault">t</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">u</span><span class="mord mathdefault">e</span><span class="mord mathdefault">c</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.01968em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">u</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">s</span><span class="mord mathdefault">e</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361079999999999em;"><span style="top:-2.5500000000000003em;margin-left:-0.02778em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right:0.10764em;">f</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord"><span class="mord mathdefault">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">a</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="mopen">(</span><span class="mopen">[</span></span></span></span>detailServiceInstance, $functionName], <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>p</mi><mi>a</mi><mi>r</mi><mi>a</mi><mi>m</mi><mi>s</mi><mo>)</mo><mo separator="true">;</mo><mi mathvariant="normal">从</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">上</mi><mi mathvariant="normal">代</mi><mi mathvariant="normal">码</mi><mi mathvariant="normal">可</mi><mi mathvariant="normal">看</mi><mi mathvariant="normal">出</mi><mi mathvariant="normal">，</mi><mi>c</mi><mi>a</mi><mi>l</mi><msub><mi>l</mi><mi>u</mi></msub><mi>s</mi><mi>e</mi><msub><mi>r</mi><mi>f</mi></msub><mi>u</mi><mi>n</mi><msub><mi>c</mi><mi>a</mi></msub><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mi mathvariant="normal">第</mi><mi mathvariant="normal">一</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">是</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">组</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">该</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">组</mi><mi mathvariant="normal">中</mi><mn>0</mn><mi mathvariant="normal">下</mi><mi mathvariant="normal">标</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">值</mi><mi mathvariant="normal">为</mi><mi mathvariant="normal">一</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">类</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">实</mi><mi mathvariant="normal">例</mi><mi mathvariant="normal">，</mi><mn>1</mn><mi mathvariant="normal">下</mi><mi mathvariant="normal">标</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">是</mi><mi mathvariant="normal">这</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">实</mi><mi mathvariant="normal">例</mi><mi mathvariant="normal">中</mi><mi mathvariant="normal">存</mi><mi mathvariant="normal">在</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">方</mi><mi mathvariant="normal">法</mi><mi mathvariant="normal">；</mi><mi mathvariant="normal">第</mi><mi mathvariant="normal">二</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">即</mi><mi mathvariant="normal">对</mi><mi mathvariant="normal">应</mi><mi mathvariant="normal">函</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">需</mi><mi mathvariant="normal">要</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">了</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">该</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">为</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">组</mi><mi mathvariant="normal">形</mi><mi mathvariant="normal">式</mi><mi mathvariant="normal">，</mi><mi>c</mi><mi>a</mi><mi>l</mi><msub><mi>l</mi><mi>u</mi></msub><mi>s</mi><mi>e</mi><msub><mi>r</mi><mi>f</mi></msub><mi>u</mi><mi>n</mi><msub><mi>c</mi><mi>a</mi></msub><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mi mathvariant="normal">会</mi><mi mathvariant="normal">自</mi><mi mathvariant="normal">动</mi><mi mathvariant="normal">按</mi><mi mathvariant="normal">顺</mi><mi mathvariant="normal">序</mi><mi mathvariant="normal">对</mi><mi mathvariant="normal">应</mi><mi mathvariant="normal">每</mi><mi mathvariant="normal">一</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">所</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">在</mi><mi mathvariant="normal">这</mi><mi mathvariant="normal">里</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">顺</mi><mi mathvariant="normal">序</mi><mi mathvariant="normal">很</mi><mi mathvariant="normal">重</mi><mi mathvariant="normal">要</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">无</mi><mi mathvariant="normal">论</mi><mi mathvariant="normal">是</mi><mi mathvariant="normal">使</mi><mi mathvariant="normal">用</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">字</mi><mi mathvariant="normal">键</mi><mi mathvariant="normal">名</mi><mi mathvariant="normal">或</mi><mi mathvariant="normal">字</mi><mi mathvariant="normal">符</mi><mi mathvariant="normal">键</mi><mi mathvariant="normal">名</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">都</mi><mi mathvariant="normal">必</mi><mi mathvariant="normal">须</mi><mi mathvariant="normal">一</mi><mi mathvariant="normal">一</mi><mi mathvariant="normal">对</mi><mi mathvariant="normal">应</mi><mi mathvariant="normal">函</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">具</mi><mi mathvariant="normal">体</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">这</mi><mi mathvariant="normal">样</mi><mi mathvariant="normal">才</mi><mi mathvariant="normal">能</mi><mi mathvariant="normal">正</mi><mi mathvariant="normal">确</mi><mi mathvariant="normal">实</mi><mi mathvariant="normal">现</mi><mi mathvariant="normal">函</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">分</mi><mi mathvariant="normal">发</mi><mi mathvariant="normal">。</mi><mn>8.1</mn><mi mathvariant="normal">反</mi><mi mathvariant="normal">射</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">应</mi><mi mathvariant="normal">用</mi><mi mathvariant="normal">使</mi><mi mathvariant="normal">用</mi><mi>c</mi><mi>a</mi><mi>l</mi><msub><mi>l</mi><mi>u</mi></msub><mi>s</mi><mi>e</mi><msub><mi>r</mi><mi>f</mi></msub><mi>u</mi><mi>n</mi><msub><mi>c</mi><mi>a</mi></msub><mi>r</mi><mi>r</mi><mi>a</mi><mi>y</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">我</mi><mi mathvariant="normal">们</mi><mi mathvariant="normal">可</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">简</mi><mi mathvariant="normal">单</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">实</mi><mi mathvariant="normal">现</mi><mi mathvariant="normal">分</mi><mi mathvariant="normal">发</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">并</mi><mi mathvariant="normal">且</mi><mi mathvariant="normal">各</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">也</mi><mi mathvariant="normal">都</mi><mi mathvariant="normal">很</mi><mi mathvariant="normal">清</mi><mi mathvariant="normal">晰</mi><mi mathvariant="normal">。</mi><mi mathvariant="normal">但</mi><mi mathvariant="normal">是</mi><mi mathvariant="normal">如</mi><mi mathvariant="normal">果</mi><mi mathvariant="normal">需</mi><mi mathvariant="normal">要</mi><mi mathvariant="normal">更</mi><mi mathvariant="normal">加</mi><mi mathvariant="normal">灵</mi><mi mathvariant="normal">活</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">运</mi><mi mathvariant="normal">用</mi><mi mathvariant="normal">这</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">函</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">我</mi><mi mathvariant="normal">们</mi><mi mathvariant="normal">还</mi><mi mathvariant="normal">需</mi><mi mathvariant="normal">要</mi><mi mathvariant="normal">引</mi><mi mathvariant="normal">入</mi><mi>P</mi><mi>H</mi><mi>P</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">反</mi><mi mathvariant="normal">射</mi><mi mathvariant="normal">机</mi><mi mathvariant="normal">制</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">如</mi><mi>P</mi><mi>H</mi><mi>P</mi><mi mathvariant="normal">自</mi><mi mathvariant="normal">带</mi><mi mathvariant="normal">的</mi><mi>R</mi><mi>e</mi><mi>f</mi><mi>l</mi><mi>e</mi><mi>c</mi><mi>t</mi><mi>i</mi><mi>o</mi><mi>n</mi><mi>M</mi><mi>e</mi><mi>t</mi><mi>h</mi><mi>o</mi><mi>d</mi><mi mathvariant="normal">类</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">我</mi><mi mathvariant="normal">们</mi><mi mathvariant="normal">可</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">通</mi><mi mathvariant="normal">过</mi><mi mathvariant="normal">这</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">类</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">来</mi><mi mathvariant="normal">直</mi><mi mathvariant="normal">接</mi><mi mathvariant="normal">获</mi><mi mathvariant="normal">取</mi><mi mathvariant="normal">到</mi><mi mathvariant="normal">某</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">类</mi><mi mathvariant="normal">中</mi><mi mathvariant="normal">具</mi><mi mathvariant="normal">体</mi><mi mathvariant="normal">方</mi><mi mathvariant="normal">法</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">各</mi><mi mathvariant="normal">类</mi><mi mathvariant="normal">信</mi><mi mathvariant="normal">息</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">如</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">个</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">参</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">名</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">是</mi><mi mathvariant="normal">否</mi><mi mathvariant="normal">有</mi><mi mathvariant="normal">默</mi><mi mathvariant="normal">认</mi><mi mathvariant="normal">值</mi><mi mathvariant="normal">等</mi><mi mathvariant="normal">等</mi><mi mathvariant="normal">。</mi><mi mathvariant="normal">代</mi><mi mathvariant="normal">码</mi><mi mathvariant="normal">如</mi><mi mathvariant="normal">下</mi><mi mathvariant="normal">：</mi></mrow><annotation encoding="application/x-tex">params);
    从以上代码可看出， call_user_func_array 第一个参数是个数组， 该数组中0下标的值  为 一个类的实例， 1下标的 是这个实例中存在的方法； 第二个参数即 对应函数需要的参数了，该参数为数组形式，call_user_func_array 会自动 按顺序对应每一个参数，所以在这里，参数的顺序很重要，无论是使用数字键名或字符键名，都必须一一对应函数具体的参数，这样才能正确实现函数的分发。
     8.1 反射的应用
            使用call_user_func_array，我们可以简单的实现分发，并且各个参数，也都很清晰。但是如果需要更加灵活的运用这个函数，我们还需要引入PHP的反射机制，如 PHP自带的 ReflectionMethod 类，
    我们可以通过这个类，来直接获取到某个类中具体方法的各类信息，如参数个数，参数名，是否有默认值等等。代码如下：
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.036108em;vertical-align:-0.286108em;"></span><span class="mord mathdefault">p</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">s</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord cjk_fallback">从</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">上</span><span class="mord cjk_fallback">代</span><span class="mord cjk_fallback">码</span><span class="mord cjk_fallback">可</span><span class="mord cjk_fallback">看</span><span class="mord cjk_fallback">出</span><span class="mord cjk_fallback">，</span><span class="mord mathdefault">c</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.01968em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">u</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">s</span><span class="mord mathdefault">e</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361079999999999em;"><span style="top:-2.5500000000000003em;margin-left:-0.02778em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right:0.10764em;">f</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord"><span class="mord mathdefault">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">a</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="mord cjk_fallback">第</span><span class="mord cjk_fallback">一</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">是</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">组</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">该</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">组</span><span class="mord cjk_fallback">中</span><span class="mord">0</span><span class="mord cjk_fallback">下</span><span class="mord cjk_fallback">标</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">值</span><span class="mord cjk_fallback">为</span><span class="mord cjk_fallback">一</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">类</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">实</span><span class="mord cjk_fallback">例</span><span class="mord cjk_fallback">，</span><span class="mord">1</span><span class="mord cjk_fallback">下</span><span class="mord cjk_fallback">标</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">是</span><span class="mord cjk_fallback">这</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">实</span><span class="mord cjk_fallback">例</span><span class="mord cjk_fallback">中</span><span class="mord cjk_fallback">存</span><span class="mord cjk_fallback">在</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">方</span><span class="mord cjk_fallback">法</span><span class="mord cjk_fallback">；</span><span class="mord cjk_fallback">第</span><span class="mord cjk_fallback">二</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">即</span><span class="mord cjk_fallback">对</span><span class="mord cjk_fallback">应</span><span class="mord cjk_fallback">函</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">需</span><span class="mord cjk_fallback">要</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">了</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">该</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">为</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">组</span><span class="mord cjk_fallback">形</span><span class="mord cjk_fallback">式</span><span class="mord cjk_fallback">，</span><span class="mord mathdefault">c</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.01968em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">u</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">s</span><span class="mord mathdefault">e</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361079999999999em;"><span style="top:-2.5500000000000003em;margin-left:-0.02778em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right:0.10764em;">f</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord"><span class="mord mathdefault">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">a</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="mord cjk_fallback">会</span><span class="mord cjk_fallback">自</span><span class="mord cjk_fallback">动</span><span class="mord cjk_fallback">按</span><span class="mord cjk_fallback">顺</span><span class="mord cjk_fallback">序</span><span class="mord cjk_fallback">对</span><span class="mord cjk_fallback">应</span><span class="mord cjk_fallback">每</span><span class="mord cjk_fallback">一</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">所</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">在</span><span class="mord cjk_fallback">这</span><span class="mord cjk_fallback">里</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">顺</span><span class="mord cjk_fallback">序</span><span class="mord cjk_fallback">很</span><span class="mord cjk_fallback">重</span><span class="mord cjk_fallback">要</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">无</span><span class="mord cjk_fallback">论</span><span class="mord cjk_fallback">是</span><span class="mord cjk_fallback">使</span><span class="mord cjk_fallback">用</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">字</span><span class="mord cjk_fallback">键</span><span class="mord cjk_fallback">名</span><span class="mord cjk_fallback">或</span><span class="mord cjk_fallback">字</span><span class="mord cjk_fallback">符</span><span class="mord cjk_fallback">键</span><span class="mord cjk_fallback">名</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">都</span><span class="mord cjk_fallback">必</span><span class="mord cjk_fallback">须</span><span class="mord cjk_fallback">一</span><span class="mord cjk_fallback">一</span><span class="mord cjk_fallback">对</span><span class="mord cjk_fallback">应</span><span class="mord cjk_fallback">函</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">具</span><span class="mord cjk_fallback">体</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">这</span><span class="mord cjk_fallback">样</span><span class="mord cjk_fallback">才</span><span class="mord cjk_fallback">能</span><span class="mord cjk_fallback">正</span><span class="mord cjk_fallback">确</span><span class="mord cjk_fallback">实</span><span class="mord cjk_fallback">现</span><span class="mord cjk_fallback">函</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">分</span><span class="mord cjk_fallback">发</span><span class="mord cjk_fallback">。</span><span class="mord">8</span><span class="mord">.</span><span class="mord">1</span><span class="mord cjk_fallback">反</span><span class="mord cjk_fallback">射</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">应</span><span class="mord cjk_fallback">用</span><span class="mord cjk_fallback">使</span><span class="mord cjk_fallback">用</span><span class="mord mathdefault">c</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.01968em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">u</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">s</span><span class="mord mathdefault">e</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361079999999999em;"><span style="top:-2.5500000000000003em;margin-left:-0.02778em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right:0.10764em;">f</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord"><span class="mord mathdefault">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">a</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">我</span><span class="mord cjk_fallback">们</span><span class="mord cjk_fallback">可</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">简</span><span class="mord cjk_fallback">单</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">实</span><span class="mord cjk_fallback">现</span><span class="mord cjk_fallback">分</span><span class="mord cjk_fallback">发</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">并</span><span class="mord cjk_fallback">且</span><span class="mord cjk_fallback">各</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">也</span><span class="mord cjk_fallback">都</span><span class="mord cjk_fallback">很</span><span class="mord cjk_fallback">清</span><span class="mord cjk_fallback">晰</span><span class="mord cjk_fallback">。</span><span class="mord cjk_fallback">但</span><span class="mord cjk_fallback">是</span><span class="mord cjk_fallback">如</span><span class="mord cjk_fallback">果</span><span class="mord cjk_fallback">需</span><span class="mord cjk_fallback">要</span><span class="mord cjk_fallback">更</span><span class="mord cjk_fallback">加</span><span class="mord cjk_fallback">灵</span><span class="mord cjk_fallback">活</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">运</span><span class="mord cjk_fallback">用</span><span class="mord cjk_fallback">这</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">函</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">我</span><span class="mord cjk_fallback">们</span><span class="mord cjk_fallback">还</span><span class="mord cjk_fallback">需</span><span class="mord cjk_fallback">要</span><span class="mord cjk_fallback">引</span><span class="mord cjk_fallback">入</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault" style="margin-right:0.08125em;">H</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">反</span><span class="mord cjk_fallback">射</span><span class="mord cjk_fallback">机</span><span class="mord cjk_fallback">制</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">如</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault" style="margin-right:0.08125em;">H</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord cjk_fallback">自</span><span class="mord cjk_fallback">带</span><span class="mord cjk_fallback">的</span><span class="mord mathdefault" style="margin-right:0.00773em;">R</span><span class="mord mathdefault">e</span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">e</span><span class="mord mathdefault">c</span><span class="mord mathdefault">t</span><span class="mord mathdefault">i</span><span class="mord mathdefault">o</span><span class="mord mathdefault">n</span><span class="mord mathdefault" style="margin-right:0.10903em;">M</span><span class="mord mathdefault">e</span><span class="mord mathdefault">t</span><span class="mord mathdefault">h</span><span class="mord mathdefault">o</span><span class="mord mathdefault">d</span><span class="mord cjk_fallback">类</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">我</span><span class="mord cjk_fallback">们</span><span class="mord cjk_fallback">可</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">通</span><span class="mord cjk_fallback">过</span><span class="mord cjk_fallback">这</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">类</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">来</span><span class="mord cjk_fallback">直</span><span class="mord cjk_fallback">接</span><span class="mord cjk_fallback">获</span><span class="mord cjk_fallback">取</span><span class="mord cjk_fallback">到</span><span class="mord cjk_fallback">某</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">类</span><span class="mord cjk_fallback">中</span><span class="mord cjk_fallback">具</span><span class="mord cjk_fallback">体</span><span class="mord cjk_fallback">方</span><span class="mord cjk_fallback">法</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">各</span><span class="mord cjk_fallback">类</span><span class="mord cjk_fallback">信</span><span class="mord cjk_fallback">息</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">如</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">个</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">参</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">名</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">是</span><span class="mord cjk_fallback">否</span><span class="mord cjk_fallback">有</span><span class="mord cjk_fallback">默</span><span class="mord cjk_fallback">认</span><span class="mord cjk_fallback">值</span><span class="mord cjk_fallback">等</span><span class="mord cjk_fallback">等</span><span class="mord cjk_fallback">。</span><span class="mord cjk_fallback">代</span><span class="mord cjk_fallback">码</span><span class="mord cjk_fallback">如</span><span class="mord cjk_fallback">下</span><span class="mord cjk_fallback">：</span></span></span></span>object = new Order();<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>f</mi><mi>u</mi><mi>n</mi><mi>c</mi><mi>t</mi><mi>i</mi><mi>o</mi><mi>n</mi><mi>N</mi><mi>a</mi><mi>m</mi><mi>e</mi><msup><mo>=</mo><mo mathvariant="normal">′</mo></msup><mi>g</mi><mi>e</mi><mi>t</mi><mi>B</mi><mi>a</mi><mi>s</mi><mi>i</mi><mi>c</mi><mi>I</mi><mi>n</mi><mi>f</mi><msup><mi>o</mi><mo mathvariant="normal">′</mo></msup><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">functionName = &#x27;getBasicInfo&#x27;;
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.946332em;vertical-align:-0.19444em;"></span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord mathdefault">c</span><span class="mord mathdefault">t</span><span class="mord mathdefault">i</span><span class="mord mathdefault">o</span><span class="mord mathdefault">n</span><span class="mord mathdefault" style="margin-right:0.10903em;">N</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">e</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel"><span class="mrel">=</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.946332em;vertical-align:-0.19444em;"></span><span class="mord mathdefault" style="margin-right:0.03588em;">g</span><span class="mord mathdefault">e</span><span class="mord mathdefault">t</span><span class="mord mathdefault" style="margin-right:0.05017em;">B</span><span class="mord mathdefault">a</span><span class="mord mathdefault">s</span><span class="mord mathdefault">i</span><span class="mord mathdefault">c</span><span class="mord mathdefault" style="margin-right:0.07847em;">I</span><span class="mord mathdefault">n</span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord"><span class="mord mathdefault">o</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct">;</span></span></span></span>reflectionObj = new \ReflectionMethod($object, <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>f</mi><mi>u</mi><mi>n</mi><mi>c</mi><mi>t</mi><mi>i</mi><mi>o</mi><mi>n</mi><mi>N</mi><mi>a</mi><mi>m</mi><mi>e</mi><mo>)</mo><mo separator="true">;</mo><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">通</mi><mi mathvariant="normal">过</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">上</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">代</mi><mi mathvariant="normal">码</mi><mi mathvariant="normal">后</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">就</mi><mi mathvariant="normal">可</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">直</mi><mi mathvariant="normal">接</mi><mi mathvariant="normal">通</mi><mi mathvariant="normal">过</mi></mrow><annotation encoding="application/x-tex">functionName);
//通过以上的代码后，就可以直接通过</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord mathdefault">u</span><span class="mord mathdefault">n</span><span class="mord mathdefault">c</span><span class="mord mathdefault">t</span><span class="mord mathdefault">i</span><span class="mord mathdefault">o</span><span class="mord mathdefault">n</span><span class="mord mathdefault" style="margin-right:0.10903em;">N</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">e</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">/</span><span class="mord">/</span><span class="mord cjk_fallback">通</span><span class="mord cjk_fallback">过</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">上</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">代</span><span class="mord cjk_fallback">码</span><span class="mord cjk_fallback">后</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">就</span><span class="mord cjk_fallback">可</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">直</span><span class="mord cjk_fallback">接</span><span class="mord cjk_fallback">通</span><span class="mord cjk_fallback">过</span></span></span></span>reflectionObj获取相关信息了，如下<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>r</mi><mi>e</mi><mi>f</mi><mi>l</mi><mi>e</mi><mi>c</mi><mi>t</mi><mi>i</mi><mi>o</mi><mi>n</mi><mi>O</mi><mi>b</mi><mi>j</mi><mo>−</mo><mo>&gt;</mo><mi>i</mi><mi>s</mi><mi>P</mi><mi>u</mi><mi>b</mi><mi>l</mi><mi>i</mi><mi>c</mi><mo>(</mo><mo>)</mo><mo separator="true">;</mo><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">可</mi><mi mathvariant="normal">判</mi><mi mathvariant="normal">断</mi><mi mathvariant="normal">该</mi><mi mathvariant="normal">方</mi><mi mathvariant="normal">法</mi><mi mathvariant="normal">是</mi><mi mathvariant="normal">否</mi><mi mathvariant="normal">为</mi><mi mathvariant="normal">公</mi><mi mathvariant="normal">有</mi><mi mathvariant="normal">方</mi><mi mathvariant="normal">法</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">还</mi><mi mathvariant="normal">有</mi><mi>i</mi><mi>s</mi><mi>P</mi><mi>r</mi><mi>i</mi><mi>v</mi><mi>a</mi><mi>t</mi><mi>e</mi><mo separator="true">,</mo><mi>i</mi><mi>s</mi><mi>P</mi><mi>r</mi><mi>o</mi><mi>t</mi><mi>e</mi><mi>c</mi><mi>t</mi><mi>e</mi><mi>d</mi><mo separator="true">,</mo><mi>i</mi><mi>s</mi><mi>S</mi><mi>t</mi><mi>a</mi><mi>t</mi><mi>i</mi><mi>c</mi><mi mathvariant="normal">等</mi><mi mathvariant="normal">等</mi></mrow><annotation encoding="application/x-tex">reflectionObj-&gt;isPublic();   //可判断该方法是否为公有方法， 还有isPrivate, isProtected, isStatic等等
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">e</span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">e</span><span class="mord mathdefault">c</span><span class="mord mathdefault">t</span><span class="mord mathdefault">i</span><span class="mord mathdefault">o</span><span class="mord mathdefault">n</span><span class="mord mathdefault" style="margin-right:0.02778em;">O</span><span class="mord mathdefault">b</span><span class="mord mathdefault" style="margin-right:0.05724em;">j</span><span class="mord">−</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">i</span><span class="mord mathdefault">s</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault">u</span><span class="mord mathdefault">b</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">i</span><span class="mord mathdefault">c</span><span class="mopen">(</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">/</span><span class="mord">/</span><span class="mord cjk_fallback">可</span><span class="mord cjk_fallback">判</span><span class="mord cjk_fallback">断</span><span class="mord cjk_fallback">该</span><span class="mord cjk_fallback">方</span><span class="mord cjk_fallback">法</span><span class="mord cjk_fallback">是</span><span class="mord cjk_fallback">否</span><span class="mord cjk_fallback">为</span><span class="mord cjk_fallback">公</span><span class="mord cjk_fallback">有</span><span class="mord cjk_fallback">方</span><span class="mord cjk_fallback">法</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">还</span><span class="mord cjk_fallback">有</span><span class="mord mathdefault">i</span><span class="mord mathdefault">s</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">i</span><span class="mord mathdefault" style="margin-right:0.03588em;">v</span><span class="mord mathdefault">a</span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathdefault">i</span><span class="mord mathdefault">s</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">o</span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mord mathdefault">c</span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mord mathdefault">d</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathdefault">i</span><span class="mord mathdefault">s</span><span class="mord mathdefault" style="margin-right:0.05764em;">S</span><span class="mord mathdefault">t</span><span class="mord mathdefault">a</span><span class="mord mathdefault">t</span><span class="mord mathdefault">i</span><span class="mord mathdefault">c</span><span class="mord cjk_fallback">等</span><span class="mord cjk_fallback">等</span></span></span></span>reflectionObj-&gt;getParameters();   //可获取该方法所有参数，是个数组，可 foreach获取具体的参数<br>
foreach($reflectionObj-&gt;getParameters() as <span class='katex-error' title='ParseError: KaTeX parse error: Expected &#039;}&#039;, got &#039;EOF&#039; at end of input: …ray_key_exists('>arg) {
    if(array_key_exists(</span>arg-&gt;name, $params)) {<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>c</mi><mi>a</mi><mi>l</mi><mi>l</mi><mi>P</mi><mi>a</mi><mi>r</mi><mi>a</mi><mi>m</mi><mi>s</mi><mo>[</mo></mrow><annotation encoding="application/x-tex">callParams[</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">c</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">s</span><span class="mopen">[</span></span></span></span>arg-&gt;name] = <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>p</mi><mi>a</mi><mi>r</mi><mi>a</mi><mi>m</mi><mi>s</mi><mo>[</mo></mrow><annotation encoding="application/x-tex">params[</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">p</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">s</span><span class="mopen">[</span></span></span></span>arg-&gt;name];<br>
} else {<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>p</mi><mi>a</mi><mi>r</mi><mi>a</mi><mi>m</mi><mi>V</mi><mi>a</mi><mi>l</mi><mo>=</mo><mi>n</mi><mi>u</mi><mi>l</mi><mi>l</mi><mo separator="true">;</mo><mi>i</mi><mi>f</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">paramVal = null;
        if (</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord mathdefault">p</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault" style="margin-right:0.22222em;">V</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">n</span><span class="mord mathdefault">u</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathdefault">i</span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mopen">(</span></span></span></span>arg-&gt;isOptional()) {  // 或使用isDefaultValueAvailable， 检测是否有可用的默认值<br>
$paramVal = $arg-&gt;getDefaultValue();<br>
}<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>c</mi><mi>a</mi><mi>l</mi><mi>l</mi><mi>P</mi><mi>a</mi><mi>r</mi><mi>a</mi><mi>m</mi><mi>s</mi><mo>[</mo></mrow><annotation encoding="application/x-tex">callParams[</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">c</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord mathdefault">s</span><span class="mopen">[</span></span></span></span>arg-&gt;name] = $paramVal;<br>
}<br>
}<br>
具体参数： https://www.php.net/manual/zh/class.reflectionmethod.php<br>
还有 ReflectionClass 可以获取一些类的信息，用法都是类似的。<br>
8.2  调用不存在的方法<br>
__call &amp; __callStatic (魔术方法)<br>
当调用类中一个不存在或者没有权限访问的方法的时候，就会自动调用__call()方法。和__call对应静态方法的调用是__callStatic， 配合PHP反射，对代码进行优化，可对一些特殊的基础业务功能做到，<br>
如工单, trinity 内部都是用了类似方法。</p>
<ol start="9">
<li>
<p>move_uploaded_file<br>
该函数是前端文件上传文件到后台后可能用到的函数，上传后，我们会通过<span class="katex"><span class="katex-mathml"><math><semantics><mrow><msub><mrow></mrow><mi>F</mi></msub><mi>I</mi><mi>L</mi><mi>E</mi><mi>S</mi><msup><mo>[</mo><mo mathvariant="normal">′</mo></msup><mi>f</mi><mi>i</mi><mi>l</mi><msup><mi>e</mi><mo mathvariant="normal">′</mo></msup><mo>]</mo><msup><mo>[</mo><mo mathvariant="normal">′</mo></msup><mi>t</mi><mi>m</mi><msub><mi>p</mi><mi>n</mi></msub><mi>a</mi><mi>m</mi><msup><mi>e</mi><mo mathvariant="normal">′</mo></msup><mo>]</mo><mo>(</mo><mi mathvariant="normal">文</mi><mi mathvariant="normal">件</mi><mi mathvariant="normal">上</mi><mi mathvariant="normal">传</mi><mi mathvariant="normal">后</mi><mi mathvariant="normal">地</mi><mi mathvariant="normal">址</mi><mo>)</mo><mi mathvariant="normal">，</mi><mi mathvariant="normal">使</mi><mi mathvariant="normal">用</mi><mi>m</mi><mi>o</mi><mi>v</mi><msub><mi>e</mi><mi>u</mi></msub><mi>p</mi><mi>l</mi><mi>o</mi><mi>a</mi><mi>d</mi><mi>e</mi><msub><mi>d</mi><mi>f</mi></msub><mi>i</mi><mi>l</mi><mi>e</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">_FILES[&#x27;file&#x27;][&#x27;tmp_name&#x27;](文件上传后地址)， 使用
move_uploaded_file(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.038em;vertical-align:-0.286108em;"></span><span class="mord"><span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.32833099999999993em;"><span style="top:-2.5500000000000003em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right:0.13889em;">F</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault" style="margin-right:0.07847em;">I</span><span class="mord mathdefault">L</span><span class="mord mathdefault" style="margin-right:0.05764em;">E</span><span class="mord mathdefault" style="margin-right:0.05764em;">S</span><span class="mopen"><span class="mopen">[</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mord mathdefault" style="margin-right:0.10764em;">f</span><span class="mord mathdefault">i</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord"><span class="mord mathdefault">e</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mclose">]</span><span class="mopen"><span class="mopen">[</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mord mathdefault">t</span><span class="mord mathdefault">m</span><span class="mord"><span class="mord mathdefault">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">n</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">a</span><span class="mord mathdefault">m</span><span class="mord"><span class="mord mathdefault">e</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mclose">]</span><span class="mopen">(</span><span class="mord cjk_fallback">文</span><span class="mord cjk_fallback">件</span><span class="mord cjk_fallback">上</span><span class="mord cjk_fallback">传</span><span class="mord cjk_fallback">后</span><span class="mord cjk_fallback">地</span><span class="mord cjk_fallback">址</span><span class="mclose">)</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">使</span><span class="mord cjk_fallback">用</span><span class="mord mathdefault">m</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right:0.03588em;">v</span><span class="mord"><span class="mord mathdefault">e</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">u</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">p</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">o</span><span class="mord mathdefault">a</span><span class="mord mathdefault">d</span><span class="mord mathdefault">e</span><span class="mord"><span class="mord mathdefault">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361079999999999em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight" style="margin-right:0.10764em;">f</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mord mathdefault">i</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">e</span><span class="mopen">(</span></span></span></span>tmp_name, <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>s</mi><mi>a</mi><mi>v</mi><mi>e</mi><mi>P</mi><mi>a</mi><mi>t</mi><mi>h</mi><mo>)</mo><mo separator="true">;</mo><mi mathvariant="normal">会</mi><mi mathvariant="normal">把</mi><mi mathvariant="normal">临</mi><mi mathvariant="normal">时</mi><mi mathvariant="normal">存</mi><mi mathvariant="normal">到</mi><mi mathvariant="normal">数</mi><mi mathvariant="normal">据</mi><mi mathvariant="normal">库</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">如</mi><mi mathvariant="normal">：</mi><mi mathvariant="normal">/</mi><mi>t</mi><mi>m</mi><mi>p</mi><mi mathvariant="normal">/</mi><mi>p</mi><mi>h</mi><mi>p</mi><mi>w</mi><mi>T</mi><mi>J</mi><mi>z</mi><mi>U</mi><mi>w</mi><mi mathvariant="normal">文</mi><mi mathvariant="normal">件</mi><mi mathvariant="normal">给</mi><mi mathvariant="normal">移</mi><mi mathvariant="normal">动</mi><mi mathvariant="normal">走</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">导</mi><mi mathvariant="normal">致</mi><mi mathvariant="normal">如</mi><mi mathvariant="normal">果</mi><mi mathvariant="normal">后</mi><mi mathvariant="normal">面</mi><mi mathvariant="normal">的</mi><mi mathvariant="normal">代</mi><mi mathvariant="normal">码</mi><mi mathvariant="normal">还</mi><mi mathvariant="normal">要</mi><mi mathvariant="normal">用</mi><mi mathvariant="normal">到</mi></mrow><annotation encoding="application/x-tex">savePath);
会把临时存到数据库的 如： /tmp/phpwTJzUw  文件给移动走，导致如果后面的代码还要用到</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">s</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.03588em;">v</span><span class="mord mathdefault">e</span><span class="mord mathdefault" style="margin-right:0.13889em;">P</span><span class="mord mathdefault">a</span><span class="mord mathdefault">t</span><span class="mord mathdefault">h</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord cjk_fallback">会</span><span class="mord cjk_fallback">把</span><span class="mord cjk_fallback">临</span><span class="mord cjk_fallback">时</span><span class="mord cjk_fallback">存</span><span class="mord cjk_fallback">到</span><span class="mord cjk_fallback">数</span><span class="mord cjk_fallback">据</span><span class="mord cjk_fallback">库</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">如</span><span class="mord cjk_fallback">：</span><span class="mord">/</span><span class="mord mathdefault">t</span><span class="mord mathdefault">m</span><span class="mord mathdefault">p</span><span class="mord">/</span><span class="mord mathdefault">p</span><span class="mord mathdefault">h</span><span class="mord mathdefault">p</span><span class="mord mathdefault" style="margin-right:0.02691em;">w</span><span class="mord mathdefault" style="margin-right:0.13889em;">T</span><span class="mord mathdefault" style="margin-right:0.09618em;">J</span><span class="mord mathdefault" style="margin-right:0.04398em;">z</span><span class="mord mathdefault" style="margin-right:0.10903em;">U</span><span class="mord mathdefault" style="margin-right:0.02691em;">w</span><span class="mord cjk_fallback">文</span><span class="mord cjk_fallback">件</span><span class="mord cjk_fallback">给</span><span class="mord cjk_fallback">移</span><span class="mord cjk_fallback">动</span><span class="mord cjk_fallback">走</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">导</span><span class="mord cjk_fallback">致</span><span class="mord cjk_fallback">如</span><span class="mord cjk_fallback">果</span><span class="mord cjk_fallback">后</span><span class="mord cjk_fallback">面</span><span class="mord cjk_fallback">的</span><span class="mord cjk_fallback">代</span><span class="mord cjk_fallback">码</span><span class="mord cjk_fallback">还</span><span class="mord cjk_fallback">要</span><span class="mord cjk_fallback">用</span><span class="mord cjk_fallback">到</span></span></span></span>_FILES全局变量的时候，会出现找不到文件的问题。</p>
</li>
<li>
<p>引用传递<br>
在使用array_pop等函数时， array_pop的参数 是引用传递，在编码过程中有时候会把 参数直接写成函数返回值，这样在 5.3以后是不允许的， 会报出致命错误（严格模式下）。<br>
You will see:<br>
PHP Strict Standards:  Only variables should be passed by reference in - on line 3</p>
</li>
</ol>
<p>Strict Standards: Only variables should be passed by reference in - on line 3<br>
d<br>
以上来自于： https://www.php.net/manual/zh/function.array-pop.php</p>
<p>按引用传递参数的函数在被按值传递调用时行为发生改变. 此前函数将接受按值传递的参数, 现在将抛出致命错误. 之前任何期待传递引用但是在调用时传递了常量或者字面值 的函数, 需要在调用前改为将该值赋给一个变量。<br>
以上来自于：PHP手册附录从PHP 5.2.x 移植到 PHP 5.3.x 部分<br>
https://www.php.net/manual/zh/migration53.incompatible.php<br>
而实际上看起来没有错， 只需要把那个函数返回值赋值给一个变量，再把变量当做参数传入就可以了。<br>
如，在代码中经常会写到：<br>
error_reporting(E_STRICT);<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi><mi>A</mi><mi>r</mi><mi>r</mi><mo>=</mo><msup><mo>[</mo><mo mathvariant="normal">′</mo></msup><msup><mi>a</mi><mo mathvariant="normal">′</mo></msup><msup><mo separator="true">,</mo><mo mathvariant="normal">′</mo></msup><msup><mi>b</mi><mo mathvariant="normal">′</mo></msup><msup><mo separator="true">,</mo><mo mathvariant="normal">′</mo></msup><msup><mi>c</mi><mo mathvariant="normal">′</mo></msup><msup><mo separator="true">,</mo><mo mathvariant="normal">′</mo></msup><msup><mi>c</mi><mo mathvariant="normal">′</mo></msup><msup><mo separator="true">,</mo><mo mathvariant="normal">′</mo></msup><msup><mi>d</mi><mo mathvariant="normal">′</mo></msup><mo>]</mo><mo separator="true">;</mo></mrow><annotation encoding="application/x-tex">testArr = [&#x27;a&#x27;,&#x27;b&#x27;,&#x27;c&#x27;,&#x27;c&#x27;,&#x27;d&#x27;];
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mord mathdefault">A</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1.001892em;vertical-align:-0.25em;"></span><span class="mopen"><span class="mopen">[</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mord"><span class="mord mathdefault">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct"><span class="mpunct">,</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathdefault">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct"><span class="mpunct">,</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathdefault">c</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct"><span class="mpunct">,</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathdefault">c</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mpunct"><span class="mpunct">,</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathdefault">d</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.751892em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">′</span></span></span></span></span></span></span></span></span><span class="mclose">]</span><span class="mpunct">;</span></span></span></span>popValue = array_pop(array_unique(<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi><mi>A</mi><mi>r</mi><mi>r</mi><mo>)</mo><mo>)</mo><mo separator="true">;</mo><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">以</mi><mi mathvariant="normal">上</mi><mi mathvariant="normal">代</mi><mi mathvariant="normal">码</mi><mi mathvariant="normal">会</mi><mi mathvariant="normal">报</mi><mi mathvariant="normal">错</mi><mi mathvariant="normal">，</mi><mi mathvariant="normal">必</mi><mi mathvariant="normal">须</mi><mi mathvariant="normal">使</mi><mi mathvariant="normal">用</mi></mrow><annotation encoding="application/x-tex">testArr));  
// 以上代码会报错，必须使用
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mord mathdefault">A</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mclose">)</span><span class="mclose">)</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">/</span><span class="mord">/</span><span class="mord cjk_fallback">以</span><span class="mord cjk_fallback">上</span><span class="mord cjk_fallback">代</span><span class="mord cjk_fallback">码</span><span class="mord cjk_fallback">会</span><span class="mord cjk_fallback">报</span><span class="mord cjk_fallback">错</span><span class="mord cjk_fallback">，</span><span class="mord cjk_fallback">必</span><span class="mord cjk_fallback">须</span><span class="mord cjk_fallback">使</span><span class="mord cjk_fallback">用</span></span></span></span>testArr = ['a','b','c','c','d'];<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi><mi>A</mi><mi>r</mi><mi>r</mi><mo>=</mo><mi>a</mi><mi>r</mi><mi>r</mi><mi>a</mi><msub><mi>y</mi><mi>u</mi></msub><mi>n</mi><mi>i</mi><mi>q</mi><mi>u</mi><mi>e</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">testArr = array_unique(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mord mathdefault">A</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:-0.03588em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">u</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">n</span><span class="mord mathdefault">i</span><span class="mord mathdefault" style="margin-right:0.03588em;">q</span><span class="mord mathdefault">u</span><span class="mord mathdefault">e</span><span class="mopen">(</span></span></span></span>testArr)<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>p</mi><mi>o</mi><mi>p</mi><mi>V</mi><mi>a</mi><mi>l</mi><mi>u</mi><mi>e</mi><mo>=</mo><mi>a</mi><mi>r</mi><mi>r</mi><mi>a</mi><msub><mi>y</mi><mi>p</mi></msub><mi>o</mi><mi>p</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">popValue = array_pop(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord mathdefault">p</span><span class="mord mathdefault">o</span><span class="mord mathdefault">p</span><span class="mord mathdefault" style="margin-right:0.22222em;">V</span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.01968em;">l</span><span class="mord mathdefault">u</span><span class="mord mathdefault">e</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1.036108em;vertical-align:-0.286108em;"></span><span class="mord mathdefault">a</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault" style="margin-right:0.02778em;">r</span><span class="mord mathdefault">a</span><span class="mord"><span class="mord mathdefault" style="margin-right:0.03588em;">y</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.15139200000000003em;"><span style="top:-2.5500000000000003em;margin-left:-0.03588em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">p</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span><span class="mord mathdefault">o</span><span class="mord mathdefault">p</span><span class="mopen">(</span></span></span></span>testArr);</p>
<ol start="11">
<li>
<p>json_encode<br>
11.1 有时候，开发的场景可能需要把数组转为对象给前端输出，但是PHP的索引数组，下标是数字，如果从零开始的话， 使用json_encode 是不会把这个数组给转化成对象的。比如：<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi><mo>=</mo><mo>[</mo><mn>0</mn><mo>=</mo><mo>&gt;</mo><mi mathvariant="normal">&quot;</mi><mi mathvariant="normal">未</mi><mi mathvariant="normal">定</mi><mi mathvariant="normal">义</mi><mi mathvariant="normal">&quot;</mi><mo separator="true">,</mo><mn>1</mn><mo>=</mo><mo>&gt;</mo><mi mathvariant="normal">&quot;</mi><mi mathvariant="normal">男</mi><mi mathvariant="normal">&quot;</mi><mo separator="true">,</mo><mn>2</mn><mo>=</mo><mo>&gt;</mo><mi mathvariant="normal">&quot;</mi><mi mathvariant="normal">女</mi><mi mathvariant="normal">&quot;</mi><mo>]</mo><mo separator="true">;</mo><mi>e</mi><mi>c</mi><mi>h</mi><mi>o</mi><mi>j</mi><mi>s</mi><mi>o</mi><msub><mi>n</mi><mi>e</mi></msub><mi>n</mi><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">test = [0 =&gt; &quot;未定义&quot;,   1 =&gt; &quot;男&quot;, 2 =&gt; &quot;女&quot;];
echo json_encode(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.61508em;vertical-align:0em;"></span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord">0</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord">&quot;</span><span class="mord cjk_fallback">未</span><span class="mord cjk_fallback">定</span><span class="mord cjk_fallback">义</span><span class="mord">&quot;</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">1</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord">&quot;</span><span class="mord cjk_fallback">男</span><span class="mord">&quot;</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">2</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">&quot;</span><span class="mord cjk_fallback">女</span><span class="mord">&quot;</span><span class="mclose">]</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathdefault">e</span><span class="mord mathdefault">c</span><span class="mord mathdefault">h</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right:0.05724em;">j</span><span class="mord mathdefault">s</span><span class="mord mathdefault">o</span><span class="mord"><span class="mord mathdefault">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">n</span><span class="mord mathdefault">c</span><span class="mord mathdefault">o</span><span class="mord mathdefault">d</span><span class="mord mathdefault">e</span><span class="mopen">(</span></span></span></span>test);<br>
以上代码会这样输出：</p>
<p>11.2 如果代码是这样的：<br>
<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi><mo>=</mo><mo>[</mo><mn>1</mn><mo>=</mo><mo>&gt;</mo><mi mathvariant="normal">&quot;</mi><mi mathvariant="normal">男</mi><mi mathvariant="normal">&quot;</mi><mo separator="true">,</mo><mn>2</mn><mo>=</mo><mo>&gt;</mo><mi mathvariant="normal">&quot;</mi><mi mathvariant="normal">女</mi><mi mathvariant="normal">&quot;</mi><mo>]</mo><mo separator="true">;</mo><mi>e</mi><mi>c</mi><mi>h</mi><mi>o</mi><mi>j</mi><mi>s</mi><mi>o</mi><msub><mi>n</mi><mi>e</mi></msub><mi>n</mi><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mo>(</mo></mrow><annotation encoding="application/x-tex">test= [1 =&gt; &quot;男&quot;, 2 =&gt; &quot;女&quot;];
echo json_encode(</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.61508em;vertical-align:0em;"></span><span class="mord mathdefault">t</span><span class="mord mathdefault">e</span><span class="mord mathdefault">s</span><span class="mord mathdefault">t</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="mord">&quot;</span><span class="mord cjk_fallback">男</span><span class="mord">&quot;</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">2</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span></span><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">&gt;</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">&quot;</span><span class="mord cjk_fallback">女</span><span class="mord">&quot;</span><span class="mclose">]</span><span class="mpunct">;</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathdefault">e</span><span class="mord mathdefault">c</span><span class="mord mathdefault">h</span><span class="mord mathdefault">o</span><span class="mord mathdefault" style="margin-right:0.05724em;">j</span><span class="mord mathdefault">s</span><span class="mord mathdefault">o</span><span class="mord"><span class="mord mathdefault">n</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.151392em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathdefault mtight">e</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathdefault">n</span><span class="mord mathdefault">c</span><span class="mord mathdefault">o</span><span class="mord mathdefault">d</span><span class="mord mathdefault">e</span><span class="mopen">(</span></span></span></span>test);<br>
这样则会输出：</p>
</li>
</ol>
<p>以上的输出，请注意符号， 请注意键值， 这说明在没有下标0的情况下， json_encode会自动把没有下标0的数组给转为对象。但是我认为这不友好，当不清楚json_encode有这个特性的开发人员使用的时候，会对这一现象感到奇怪。<br>
11.3 于是我们可以这么写代码。<br>
<span class='katex-error' title='ParseError: KaTeX parse error: Undefined control sequence: \ArrayObject at position 12: test = new \̲A̲r̲r̲a̲y̲O̲b̲j̲e̲c̲t̲([0 =&gt; &quot;未定义&quot;,  …'>test = new \ArrayObject([0 =&gt; &quot;未定义&quot;,   1 =&gt; &quot;男&quot;, 2 =&gt; &quot;女&quot;]);
echo json_encode(</span>test);die;<br>
这一就会输出：</p>
<p>注意符号与键值，这样我们就确保即使有下标0，我们也能显示的把数组给转成对象后，再给json_encode了。<br>
ArrayObject 是 SPL扩展库的内置函数，所以需要安装SPL扩展， 不过似乎现在都已经内置在PHP里了。</p>
<ol start="12">
<li>
<p>implode<br>
implode有很大的坑，在PHP 5.6的时候， 该函数的两个参数，是可以互换的。正常要求是，第一个参数是 分割字符串， 第二个是 数组。同时可以换过来。 PHP7，该坑被去掉了。只能是正常的传参了。</p>
</li>
<li>
<p>禁用cookie后， 如何才能继续使用session<br>
https://www.cnblogs.com/Renyi-Fan/p/11012086.html</p>
</li>
</ol>

            </div>
            <hr style="width: 80%;">
            
            <div class="donateContainer">
                <span class="donatebtn">赏</span>
            </div>
            <div class="donateContainer">
                <img src="https://oss.maxhua.cn/Wechat_shoukuanma.png" alt="" class="donate">
            </div>
            
            <div class="postfooter">
                <ul class="post-copyright">
                    <li><strong>文章作者：</strong>逸晖</li>
            <li><strong>原文链接：</strong>https://hzqyihui.github.io/post/php-zhi-shi-dian-fen-xiang/</li>
            <li><strong>版权声明：</strong>本博客所有文章除特别声明外，均采用<i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA
                许可协议。转载请注明出处！</li>
            </ul>
        </div>
        
            <div class="shareContainer">
                <div class="share" style="height:30px;">
                    <a class="qq" href=""><i><img class="shareicon"
                                src="https://hzqyihui.github.io/media/images/qqs.png" alt=""></i></a>
                    <a class="wechat" href=""><i><img class="shareicon"
                                src="https://hzqyihui.github.io/media/images/wechats.png" alt=""></i></a>
                    <a class="weibo" href=""><i><img class="shareicon"
                                src="https://hzqyihui.github.io/media/images/weibos.png" alt=""></i></a>
                    <a class="qzone" href=""><i><img class="shareicon"
                                src="https://hzqyihui.github.io/media/images/qzones.png" alt=""></i></a>
                    <a class="douban" href=""><i><img class="shareicon"
                                src="https://hzqyihui.github.io/media/images/doubans.png" alt=""></i></a>
                    <a class="facebook" href=""><i><img class="shareicon"
                                src="https://hzqyihui.github.io/media/images/facebooks.png" alt=""></i></a>
                    <a class="twitter" href=""><i><img class="shareicon"
                                src="https://hzqyihui.github.io/media/images/twitter.png" alt=""></i></a>
                </div>
            </div>
            
        <div id="otherpost">
            
            <a  data-pjax class="prev-post-pc" href="https://hzqyihui.github.io/post/nginx-an-zhuang/"  style="color: black;">
                <div id="ppcontainer">
                    
                    <img src="https://oss.maxhua.cn/surface_cover/git-ming-ling-xing-ri-chang-zhi-ling.jpeg" style="width: 100%;" class="opimg">
                    
                    <h4 class="optitle">Nginx 安装</h4>
                </div>
            </a>
            <div class="prev-post">
                上一篇 <a  data-pjax href="https://hzqyihui.github.io/post/nginx-an-zhuang/">Nginx 安装</a>
            </div>
            
            
            <a data-pjax class="next-post-pc" href="https://hzqyihui.github.io/post/zsh-cha-jian-an-zhuang/"  style="color: black;">
                <div id="npcontainer">
                    
                    <img src="https://oss.maxhua.cn/surface_cover/13zm19g.png" style="width: 100%;" class="opimg">
                    
                    <h4 class="optitle">Zsh 插件安装：</h4>
                </div>
            </a>
            <div class="next-post">
                下一篇 <a  data-pjax href="https://hzqyihui.github.io/post/zsh-cha-jian-an-zhuang/">Zsh 插件安装：</a>
            </div>
            
        </div>
    </div>
    </div>
    </div>
    <!-- 弹窗 -->
    <div id="myModal" class="modal">
        <img class="modal-content" id="img01">
    </div>
</body>
<script>
    //文章阅读热度
    var pl = $("#pl").html();
    var rootaddr = $("#rootaddr").html();
    pl = pl.replace(rootaddr, "");
    $("#hotnum").attr('id', pl);
</script>
                    <div class="toc-container">
                        <ul class="markdownIt-TOC">
<li><a href="#%E6%95%B0%E6%8D%AE%E4%BC%A0%E8%BE%93%E5%9D%87%E6%98%AF%E5%AD%97%E7%AC%A6%E4%B8%B2%E7%B1%BB%E5%9E%8B">数据传输均是字符串类型</a></li>
<li><a href="#%E9%99%A4%E4%BA%86%E8%B5%84%E6%BA%90%E7%B1%BB%E5%9E%8B%E5%9D%87%E5%8F%AF%E5%BA%8F%E5%88%97%E5%8C%96">除了资源类型，均可序列化</a></li>
<li><a href="#%E5%BA%8F%E5%88%97%E5%8C%96%E5%9C%A8%E5%AD%98%E6%94%BE%E6%95%B0%E6%8D%AE%E6%97%B6%E4%BC%9A%E5%AD%98%E6%94%BE%E6%95%B0%E6%8D%AE%E6%9C%AC%E8%BA%AB%E4%B9%9F%E4%BC%9A%E5%AD%98%E6%94%BE%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B">序列化在存放数据时，会存放数据本身，也会存放数据类型</a></li>
<li><a href="#%E5%BA%8F%E5%88%97%E5%8C%96">序列化</a></li>
<li><a href="#%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96">反序列化</a></li>
</ul>

                    </div>
                    <div class="tog">
                        <div class="toggleContainer">
                            <div class="toggle">
                                <i class="fas fa-angle-double-up"></i>
                            </div>
                        </div>
                    </div>
                    <!---------------------------- 评论系统👇 ------------------------->
                    <div id="comment" class="comment">
                        <div class="commentcontainer">
                            
                                
                                    
        <div id="vcomments">
        </div>
        <script>
            var valine = new Valine();
            var curpath = window.location.pathname;
            if (curpath[curpath.length - 1] != '/')
                curpath += '/'
            valine.init({
                el: '#vcomments',
                appId: '6kX8OLncEr2WFzTCkIaiZzkj-gzGzoHsz',
                appKey: 'nSVcrCBD1jAuhDiW4uhz2szQ',
                avatar: 'retro',
                pageSize: 10,
                placeholder: '既然来了，何不畅所欲言呢？',
                recordIP: true,
                path: curpath //[重点] 记得添加path路径
            });
        </script>
        <script type="text/javascript">
            var jrsc = '既然来了，何不畅所欲言呢？';
            jinrishici.load(function (result) {
                // 自己的处理逻辑
                jrsc = result.data.content + "\n「" + result.data.origin.title + "」" + result.data.origin
                    .dynasty + " · " + result.data.origin.author;
            });
        </script>


                                    <div class="clear"></div>
                                
                            
                        </div>
                    </div>
                    <!---------------------------- 评论系统👆 ------------------------->
                </div>
                <!-- main标签，pjax渲染时加载以上内容👆 -->
                <div class="col-md-1 col-lg-2"></div>
                <div id="bg">
                </div>
            </div>
            <!-- ----------------左侧菜单栏html 👆-------------------------------------->
            
        </div>
        <!-- aplayer播放器加载👇 -->
            
            <head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
</head>

<body>
    <div class="miniMode">
        <meting-js id="myaplayer" server="netease" type="playlist" fixed="true" order="default" muted="muted">
        </meting-js>
    </div>
</body>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
<script>
    function aplayerInit() {
        var aplayerid = "2025151208";
        var aplayerserver = "netease";
        var aplayerorder = "random";
        var aplayerautoplay = "false";
        var aplayer = $("#myaplayer");
        aplayer.attr("server", aplayerserver);
        aplayer.attr("id", aplayerid);
        aplayer.attr("order", aplayerorder);
        if (aplayerautoplay == "true")
            aplayer.attr("autoplay", "true");
    }
    aplayerInit();
</script>

<script src="https://cdn.jsdelivr.net/gh/850552586/ericamcdn@0.1/js/Aplayer.min.js"></script>
<!-- require MetingJS -->
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>

<script>
    function aplayerbtnInit() {
        var player = document.querySelectorAll('meting-js')[0].aplayer;
        if(player==undefined)return false;
        player.lrc.hide();
        var mbabtn = $("#mbaplayer");
        if (player.paused == false) {
            mbabtn.removeClass("fa-play-circle-o");
            mbabtn.addClass("fa-pause-circle");
        } else {
            mbabtn.addClass("fa-play-circle-o");
            mbabtn.removeClass("fa-pause-circle");
        }
    }

    function aplayerPlay() {
        var player = document.querySelectorAll('meting-js')[0].aplayer;
        var mbabtn = $("#mbaplayer");
        if (player.paused == true) {
            player.play();
            mbabtn.removeClass("fa-play-circle-o");
            mbabtn.addClass("fa-pause-circle");
        } else {
            player.pause();
            mbabtn.addClass("fa-play-circle-o");
            mbabtn.removeClass("fa-pause-circle");
        }
    }
</script>
            
        <!-- aplayer播放器加载👆 -->
    </div>
    <!-- 背景图加载方式👇 -->
    <div id="bgchoice" style="display: none">default
                </div>
                
                <div id="bgurl" style="display:none">/media/images/custom-bgimage.jpg</div>
                
    <!-- 背景图加载方式👆 -->
</body>

<script>
    //初始化
    //更换twikoo头像
    setTimeout(replaceAvatar,1000);
    setTimeout(replaceAvatar,2000);
    setTimeout(replaceAvatar,8000);
    // --------为每张图片添加懒加载（lazyload）标签-->懒加载功能 👇------------
    lazyload();
    //为文章内所有代码块添加代码复制功能 👇
    codeinit();
    // ------代码高亮显示功能-------------
    hljs.initHighlightingOnLoad();
    if (shareChoice)
        shareInit();
    if (donateChoice)
        donateInit();
</script>

<!------------------ 加载live2d模型功能（看板娘）👇 ---------------->

<script type="text/javascript">
    var message_Path = '/live2d/'
    var home_Path = document.getElementById("domainname").innerHTML + "/"; //此处修改为你的域名，必须带斜杠
</script>
<script type="text/javascript" src="https://hzqyihui.github.io/media/js/live2d.js"></script>
<script type="text/javascript" src="https://hzqyihui.github.io/media/live2d/js/message.js"></script>
<script type="text/javascript">
    loadlive2d("live2d", "https://hzqyihui.github.io/media/live2d/assets/tororo.model.json");
</script>

<!------------------ 加载live2d模型功能（看板娘）👆 ---------------->


<!----------------------- 返回顶部按钮功能👇 --------------------->
<script>
    $(function () {
        $('.toggleContainer').click(function () {
            $('html,body').animate({
                scrollTop: '0px'
            }, 800);
        });
        $(window).scroll(function () {
            var st = $(window).scrollTop();
            if (st > 30) {
                $(".toggleContainer").fadeIn(400);
            } else {
                $(".toggleContainer").fadeOut(100);
            }
        });
    });
</script>
<!----------------------- 返回顶部按钮功能👆 --------------------->


<!------------ 加载全局背景图功能👇（开始时没有写好，这功能有点鸡肋/(ㄒoㄒ)/~~） -->
<script>
    var bgchoice = "default"
    var bg = $('#bg');
    var bgurl = document.getElementById("bgurl").innerHTML;
    if (bgchoice == 'default')
    {
        for (var i = 0; i < 3; i++)
            bgurl = bgurl.replace("\\", "/");
        bgurl = "https://hzqyihui.github.io/" + bgurl;
    }
    bg.css("background", "url('" + bgurl + "')");

    window.onload = function () {
        aplayerbtnInit();
    }
</script>
<!------------ 加载全局背景图功能👆（开始时没有写好，这功能有点鸡肋/(ㄒoㄒ)/~~） -->




<script src="https://hzqyihui.github.io/media/js/index.js"></script>


<script>
    //加载后的事件同步（阅读量、移动端评论等
    window.onload = function () {
    //代码块高亮渲染
    document.querySelectorAll('pre code').forEach((block) => {
            hljs.highlightBlock(block);
    });
        getHotnum();
        var sharepc = $(".share").eq(0).html();
        $(".share").eq(1).html(sharepc);   //插件只会寻找一个分享标签渲染，所以需要手动添加到移动端
        aplayerbtnInit();
        $(".hljs").css({
            "padding": "20px"
        })
    }
</script>

<!-- <script src="https://hzqyihui.github.io/media/js/av-min.js"></script> -->
<!-- <script src="https://cdn.jsdelivr.net/npm/leancloud-storage@3.13.0/dist/av-min.js"></script> -->
<!-- <script src="https://cdn.jsdelivr.net/npm/leancloud-storage@4.6.1/dist/av-live-query-min.js"></script> -->